我在将twitter API twitcurl与我的OpenFrameworks解决方案集成时遇到问题。维基指令声明将构建的库静态链接到我的解决方案。这就是我所做的。
我遵循的步骤:
1)下载twitcurl库并在VS2012上构建它。解决方案文件基于VS2010,因此我必须在2012年更新它。构建版本是发布版本。
2)将twitcurl.lib从其release文件夹静态链接到我的OpenFrameworks解决方案。
以下是我在尝试构建它后遇到的错误:
1>twitcurl.lib(oauthlib.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>twitcurl.lib(oauthlib.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1>twitcurl.lib(twitcurl.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>twitcurl.lib(twitcurl.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1>twitcurl.lib(HMAC_SHA1.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>twitcurl.lib(HMAC_SHA1.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1>twitcurl.lib(base64.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>twitcurl.lib(base64.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
1>twitcurl.lib(urlencode.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
1>twitcurl.lib(urlencode.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj
我从一些阅读中了解到这些错误后,通常会在尝试将发布版本静态链接到调试版本时观察到这些错误。随后我尝试了所有其他组合,尝试在调试模式下构建twitcurl,反之亦然。静态链接库的调试版本会给我带来更多错误,例如:
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_slist_free_all referenced in function "public: bool __thiscall twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function "public: __thiscall twitCurl::twitCurl(void)" (??0twitCurl@@QAE@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function "public: __thiscall twitCurl::twitCurl(void)" (??0twitCurl@@QAE@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function "public: bool __thiscall twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function "public: __thiscall twitCurl::~twitCurl(void)" (??1twitCurl@@QAE@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_getinfo referenced in function "public: bool __thiscall twitCurl::oAuthHandlePIN(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?oAuthHandlePIN@twitCurl@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>bin\SocialBuildings_debug.exe : fatal error LNK1120: 7 unresolved externals
这是什么原因?我该如何找到解决方法?
非常感谢你的帮助
答案 0 :(得分:0)
因此,一些变化解决了我的问题:
1)在:解决方案属性&gt; C / C ++&gt;预处理器&gt;预处理器定义
集:
_ITERATOR_DEBUG_LEVEL = 2
(试图先修改实际的dll,但失败了,损坏了dll)
2)在:解决方案属性&gt; C / C ++&gt;代码生成&gt;运行时库
更改为:
多线程DLL
我基本上确保这两个版本的两个字段相同(导致问题的原因)