Hello everyone.
I’m actually trying to develop a game that use the Twitter API. To do that I use an external static library called twitcurl . I have no problem to include the static library but some error appear when I instantiate the twitcurl class:
Error Message:
[11/11] Link UE4Editor-Twithunter-7382.dll
1> Creating library A:\Repository tortoise\Twithunter\Intermediate\Build\Win64\TwithunterEditor\Development\UE4Editor-Twithunter-7382.lib and object A:\Repository tortoise\Twithunter\Intermediate\Build\Win64\TwithunterEditor\Development\UE4Editor-Twithunter-7382.exp
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_slist_append referenced in function "public: bool __cdecl twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_slist_free_all referenced in function "public: bool __cdecl twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_easy_init referenced in function "public: __cdecl twitCurl::twitCurl(void)" (??0twitCurl@@QEAA@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_easy_setopt referenced in function "public: __cdecl twitCurl::twitCurl(void)" (??0twitCurl@@QEAA@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_easy_perform referenced in function "public: bool __cdecl twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_easy_cleanup referenced in function "public: __cdecl twitCurl::~twitCurl(void)" (??1twitCurl@@QEAA@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol curl_easy_getinfo referenced in function "public: bool __cdecl twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>A:\Repository tortoise\Twithunter\Binaries\Win64\UE4Editor-Twithunter-7382.dll : fatal error LNK1120: 7 unresolved externals
But I have no problem before that. Here some code that can help you (I suppose):
CTwitHunter class:
#pragma once
#include "AllowWindowsPlatformTypes.h"
#include <twitcurl.h>
#include <oauthlib.h>
#include "HideWindowsPlatformTypes.h"
/**
*
*/
class TWITHUNTER_API CTwithunter
{
public:
CTwithunter();
~CTwithunter();
private:
twitCurl _tweet;
};
TwitHunter.Build.cs:
public class Twithunter : ModuleRules
{
private string ModulePath
{
get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
}
private string ThirdPartyPath
{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
}
public Twithunter(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D" });
PrivateDependencyModuleNames.AddRange(new string[] { });
Loadtwitcurl(Target);
}
public bool Loadtwitcurl(TargetInfo Target)
{
bool isLibrarySupported = false;
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
{
isLibrarySupported = true;
string LibraryPath = Path.Combine(ThirdPartyPath, "twitcurl", "lib");
PublicLibraryPaths.Add(LibraryPath);
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "twitcurl.lib"));
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "twitcurl", "include"));
}
Definitions.Add(string.Format("WITH_SIXENSE_BINDING={0}", isLibrarySupported ? 1 : 0));
return isLibrarySupported;
}
}