Hi!
I’m using a external library into my game project. This is the Build.cs file:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class MyGameProject : ModuleRules
{
public MyGameProject(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });
PrivateDependencyModuleNames.AddRange(new string[]
{
"SQLiteCore",
"SQLiteSupport"
});
// Third party libraries
string ExternalLibraryDirectory = "G:\\Sources\\Repos\\MyExternalLibraries\\";
string Platform = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
PublicIncludePaths.AddRange(new string[] {
ExternalLibraryDirectory + "Include"
});
PublicAdditionalLibraries.AddRange(new string[] {
ExternalLibraryDirectory + Platform + "\\Debug\\MyExternalLibrary.lib"
});
}
}
When I try to compile I get this errors:
1> Creating library G:\Sources\MyGameProject\Intermediate\Build\Win64\UnrealEditor\DebugGame\MyGameProject\UnrealEditor-MyGameProject-Win64-DebugGame.lib and object G:\Sources\MyGameProject\Intermediate\Build\Win64\UnrealEditor\DebugGame \MyGameProject\UnrealEditor-MyGameProject-Win64-DebugGame.exp
1>[17/18] Link UnrealEditor-MyGameProject-Win64-DebugGame.dll
1>MyExternalLibrary.lib(MyClassOne.obj) : error LNK2038: differences detected for '_ITERATOR_DEBUG_LEVEL': value '2' does not match value '0' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1>MyExternalLibrary.lib(MyClassOne.obj) : error LNK2038: differences detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MD_DynamicRelease' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1>MyExternalLibrary.lib(MyClassOne.obj) : warning LNK4075: '/EDITANDCONTINUE' is skipped due to '/INCREMENTAL:NO' specification
1>MyExternalLibrary.lib(MyClassTwo.obj) : error LNK2038: differences detected for '_ITERATOR_DEBUG_LEVEL': value '2' does not match value '0' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1>MyExternalLibrary.lib(MyClassTwo.obj) : error LNK2038: differences detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MD_DynamicRelease' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1>MyExternalLibrary.lib(Utils.obj) : error LNK2038: differences detected for '_ITERATOR_DEBUG_LEVEL': value '2' does not match value '0' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1>MyExternalLibrary.lib(Utils.obj) : error LNK2038: differences detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MD_DynamicRelease' in SharedPCH.Engine.NonOptimized.ShadowErrors.h.obj
1> Creating library G:\Sources\MyGameProject\Intermediate\Build\Win64\UnrealEditor\DebugGame\MyGameProject\UnrealEditor-MyGameProject-Win64-DebugGame.suppressed.lib and object G:\Sources\MyGameProject\Intermediate\Build\Win64\UnrealEditor \DebugGame\MyGameProject\UnrealEditor-MyGameProject-Win64-DebugGame.suppressed.exp
1>MyExternalLibrary.lib(MyClassOne.obj) : LNK2019 error: unresolved external symbol __imp__invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (?? $_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)
1>MyExternalLibrary.lib(MyClassTwo.obj) : LNK2001 error: unresolved external symbol __imp__invalid_parameter
1>MyExternalLibrary.lib(MyClassOne.obj) : LNK2019 error: unresolved external symbol __imp__CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (?? $_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)
1>MyExternalLibrary.lib(MyClassTwo.obj) : LNK2001 error: unresolved external symbol __imp__CrtDbgReport
1>G:\Sources\MyGameProject\Binaries\Win64\UnrealEditor-MyGameProject-Win64-DebugGame.dll : fatal error LNK1120: unresolved external 2
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command ""G:\Program Files \Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat" MyGameProjectEditor Win64 DebugGame -Project="G:\Sources\MyGameProject\MyGameProject.uproject" -WaitMutex -FromMsBuild" exited with code 6.
1>Compilation of project "MyGameProject.vcxproj" finished -- ERROR.
========== Compile: 0 correct, 1 incorrect, 0 updated, 1 skipped ==========
I’m compiling it with this configuration:
And for the external library:
How can I fix this problem?