=== Addendum ===
I tried a ultra simple c++ project. Just
int TestFunc1()
{
return 1;
}
with a header file, built it, call it in my main game project cpp’s and it works fine.
Then we took another .lib for head tracking devices, and that links too.
So what is special about lib_json.lib that it would fail in editor mode?
=============================
We distilled this down…
Unreal 4.7.2 Windows 8
Given the default FPS Shooter in unreal, we then try to add the GitHub JasonCPP library.
We get it from git hub (GitHub - open-source-parsers/jsoncpp: A C++ library for interacting with JSON.) and in the
C:\Users\MyName\Desktop\jsoncpp-master\makefiles\msvc2010
we build it in visual studio. (Yes we set the /MD flag)
We get a resulting lib_json.lib
In MyProject run visual studio. We have edited the MyProject.Build.cs and such.
It builds fine in Development configuration.
If we then switch to Development Editor it fails.
It is not linking in the lib_json.lib
The current Build cs file is
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class MyProject : ModuleRules
{
public MyProject(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
LoadJasonCPP(Target);
}
private string ModulePath
{
get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
}
private string ThirdPartyPath
{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
}
public bool LoadJasonCPP(TargetInfo Target)
{
bool isLibrarySupported = true;
string LibrariesPath = Path.Combine(ThirdPartyPath, "JasonCPP", "Libraries");
PublicAdditionalLibraries.Add("C:/LinkTest/MyProject/ThirdParty/JasonCPP/Libraries/lib_json.lib");
// Include path
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "JasonCPP", "Includes"));
Definitions.Add(string.Format("HAS_JASON_CPP_IN_UNREAL={0}", isLibrarySupported ? 1 : 0));
return isLibrarySupported;
}
}
We have worked on this for 2 days.
We tried…
- With and without a hard coded path to the lib_json.lib
- All different threading models in the lib (currently is back to /MD)
Any ideas?
We are in a maze of twisty little passages, all alike…
This can be easily recreated by making the FPS shooter as a C++ game in Epic Games Launcher,
then get json cpp from GitHub, and build is as described.
We are trying to switch from Unity to Unreal and this is making Unreal look waaaaay more difficult to use than Unity. (So there!)