静态链接 pion 网络库
我正在尝试在我的应用程序中链接 pion 网络库 4.0.3。我尝试简单地在 RELEASE_STATIC 模式下编译 pion::netlib - 这有效。然而,当我在应用程序中链接它时,我得到了很多未解决的外部问题。
然后我发现 RELEASE_STATIC 配置定义了 PION_STATIC_LINKING,并且从另一篇关于另一个库的文章中我发现我可能还需要在我的程序中定义 PION_STATIC_LINKING。
这样做会在以下模板中产生几个 100 个错误:
error LNK2005: _tolower already defined in MSVCRT.lib(MSVCR100.dll) C:\Users\name\Documents\Visual Studio 2010\Projects\myproj\LIBCMT.lib(tolower.obj) myproj
我尝试使用 /NODEFAULTLIB:libcmt 但仍然收到错误,指出 pion-common.lib / pion-net.lib 中已定义某些函数。
有什么想法吗? :(
I am trying to link pion network library 4.0.3 in my application. I tried to simply compile pion::netlib in RELEASE_STATIC mode - which worked. However, when I linked against it in my application I get alot of unresolved externals.
Then I found out that RELEASE_STATIC configuration defines PION_STATIC_LINKING, and from another post about another library I found out I probably need to define PION_STATIC_LINKING in my program aswell.
Doing so yields a few 100 errors along the following template:
error LNK2005: _tolower already defined in MSVCRT.lib(MSVCR100.dll) C:\Users\name\Documents\Visual Studio 2010\Projects\myproj\LIBCMT.lib(tolower.obj) myproj
I tried to use /NODEFAULTLIB:libcmt but I still get errors that say certain functions already defined in pion-common.lib / pion-net.lib.
Any ideas? :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很可能是因为您正在使用 /MT(多线程)设置进行代码生成来编译项目,而 pion 网络库是使用 /MD(多线程 DLL)进行编译,反之亦然。如果配置是 /MT,请尝试将配置更改为 /MD,反之亦然。为此,请转到
Project -> <项目名称>属性... ->配置属性-> C/C++->代码生成
。在右侧面板中,您应该能够看到设置运行时库
。更改那里的选项并重建整个解决方案。This could most probably be because you are compiling your project using /MT (Multi-threaded) settings for Code Generation, while pion network library was compiled using /MD (Multi-threaded DLL) or vice-versa. Try changing your configuration to /MD if it's /MT or vice-versa. To do this, go to
Project -> <ProjectName> Properties... -> Configuration Properties -> C/C++ -> Code Generation
. In the right panel you should be able to see the settingRuntime Library
. Change the options there and rebuild your whole solution.