Hello all. I’d like to use HMAC-SHA1 from CryptPP. I updated my Build.cs to add the module and then used CryptPP headers. After trying to use the library and compiling, I get “mismatch detected” errors.
My current Build.cs:
public class {projectname} : ModuleRules
{
private string ModulePath
{
get { return ModuleDirectory; }
}
private string ThirdPartyPath
{
get { return Path.GetFullPath( Path.Combine( ModulePath, "../../ThirdParty/" ) ); }
}
public {projectname}(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] {
"Core",
"CoreUObject",
"Engine",
"HTTP",
"InputCore",
"HeadMountedDisplay",
"Json", "JsonUtilities",
"CryptoPP"
});
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
{
AddEngineThirdPartyPrivateStaticDependencies(Target, "CryptoPP");
}
PublicIncludePathModuleNames.Add("CryptoPP");
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "CryptoPP", "5.6.2/include"));
PublicIncludePaths.Add("CryptoPP/5.6.2/include");
}
}
CryptPP headers added:
#include "cryptlib.h"
#include "hmac.h"
#include "sha.h"
.cpp using the library:
CryptoPP::SecByteBlock key;
CryptoPP::HMAC<CryptoPP::SHA512> MyInstance(key, key.size());
Compile error I’m getting:
1>cryptlib.lib(cryptlib.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in PCH.ue4twitter.h.obj
Researching the error it looks like I’m using different compiler versions for the static library and my project. I even tried recompiling the library but no success.
Not sure if it means something, but if I don’t use the library but keep only the includes from CryptPP it actually compiles.
Using Visual Studio 2015.