Windows 10 Pro 1803 17134.112 64-Bit
AWS C++ SDK 1.4.74
Visual Studio 2017 Community Edition 15.7.3
Unreal Engine 4.19.2
cmake ../ -G "NMake Makefiles" -DTARGET_ARCH=WINDOWS -DBUILD_ONLY="core;gamelift" -DCUSTOM_MEMORY_MANAGEMENT=0 -DBUILD_SHARED_LIBS=1
Hey,
i have builded the AWS SDK successfully, but if i use the SDK with Unreal Engine 4 in my plugin, to integrate Gamelift, the linker throws the error below.
Error: LNK2001 undefined reference "char const * const Aws::Http::CONTENT_TYPE_HEADER" (?CONTENT_TYPE_HEADER@Http@Aws@@3PEBDEB)". PluginTest D:\PluginTest\Intermediate\ProjectFiles\Module.GameLiftPlugin.cpp.obj
can anyone help me out?
thanks
Ok, finally i found a working solution, let me share the solution for other Unreal Developer that run into this problem.
USE_IMPORT_EXPORT
When you use a plugin or a module(a game himself is module) u can add a public definition in the _PluginOrModuleName.Build.cs_ file like the example below.
public class MyPlugin : ModuleRules
{
public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
bEnableExceptions = true;
PublicDependencyModuleNames.AddRange(new string[] {
"Engine",
"Core",
"CoreUObject",
"InputCore",
"Projects",
"AWSCore"
});
PublicIncludePaths.AddRange(new string[]{
"GameLiftClientSDK/Public"
});
PrivateIncludePaths.AddRange(new string[] {
"GameLiftClientSDK/Private"
});
PublicDefinitions.Add("USE_IMPORT_EXPORT");
.....
}
}`
If your build fail again, it麓s can be needed to delete the _Intermediate_ and _Binaries_ folder and let regenerate your Visual Studio Project files by Unreal.
Regards ;)
Make sure to create the cmake output folder inside the sdk source code, didn't work for me outside of it
Glad that you found a way out. If you generate your project using cmake, you can actually add this macro into you cmake script.
@singku How to add this macro into my cmake script? I tried add "add_definitions( -D USE_IMPORT_EXPORT )" or "add_compile_definitions(USE_IMPORT_EXPORT)" in CMakeLists.txt file under aws-sdk-cpp, and then run the cmake command. But they doesn't work. Am I using the wrong method?
Most helpful comment
Ok, finally i found a working solution, let me share the solution for other Unreal Developer that run into this problem.
Dynamic linking a library of AWS C++ SDK need the preprocessor directive below.
How you can add it to your Visual Studio Project Solution?
If your build fail again, it麓s can be needed to delete the _Intermediate_ and _Binaries_ folder and let regenerate your Visual Studio Project files by Unreal.
Regards ;)