简体   繁体   English

将twitcurl库从VS2010解决方案静态链接到VS2012解决方案的问题

[英]Problems with statically linking twitcurl library from VS2010 solution to VS2012 solution

I am having trouble with integrating the twitter API twitcurl with my OpenFrameworks solution. 我在将twitter API twitcurl与我的OpenFrameworks解决方案集成时遇到了麻烦。 The wiki instructions state to statically link the built library to my solution. Wiki指示声明将构建的库静态链接到我的解决方案。 Which is what I have done. 这是我所做的。

Steps I followed: 我遵循的步骤:

1) Downloaded the twitcurl library and built it on VS2012. 1)下载twitcurl库并在VS2012上构建它。 The solution file was based in VS2010 so I had to update it within 2012. The build was as a release version. 解决方案文件基于VS2010,因此我不得不在2012年内对其进行更新。该版本是发行版本。

2) Statically linked twitcurl.lib from its release folder to my OpenFrameworks solution. 2)将twitcurl.lib从其发布文件夹静态链接到我的OpenFrameworks解决方案。

Here are the errors I am getting after trying to build it: 这是我尝试构建它后遇到的错误:

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

I have learnt from some reading following these errors, that these are usually observed when trying to statically link a release version to a debug version. 从这些错误之后的阅读中我了解到,在尝试将发行版本静态链接到调试版本时,通常会观察到这些错误。 Subsequently I have tried all other combinations, tried building twitcurl in debug mode, and the other way around. 随后,我尝试了所有其他组合,尝试以调试模式构建twitcurl,反之亦然。 Statically linking the debug version of the library gives me more errors, such as: 静态链接库的调试版本会给我带来更多错误,例如:

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

What is the reason for this? 这是什么原因呢? and how can I find a workaround? 以及如何找到解决方法?

Thanks a lot for your help 非常感谢你的帮助

So a couple of changes solved my issue: 因此,通过一些更改解决了我的问题:

1) In: Solution properties > C/C++ > Preprocessor > Preprocessor Definitions 1)在:解决方案属性> C / C ++>预处理器>预处理器定义中

Set: 组:

_ITERATOR_DEBUG_LEVEL=2 _ITERATOR_DEBUG_LEVEL = 2

(Tried to modify the actual dll first, but that failed, corrupted dll) (试图先修改实际的dll,但失败了,损坏的dll)

2) In: Solution properties > C/C++ > Code Generation > Runtime Library 2)在:解决方案属性> C / C ++>代码生成>运行时库

Change to: 改成:

Multi-threaded DLL 多线程DLL

I basically made sure these two fields were the same for both builds (which is what was causing the problem) 我基本上确保这两个版本的两个字段都相同(这就是导致问题的原因)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM