简体   繁体   English

静态链接到pion网络库

[英]Linking statically against pion network library

I am trying to link pion network library 4.0.3 in my application. 我想在我的应用程序中链接pion网络库4.0.3。 I tried to simply compile pion::netlib in RELEASE_STATIC mode - which worked. 我试图在RELEASE_STATIC模式下编译pion :: netlib - 这很有用。 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. 然后我发现RELEASE_STATIC配置定义了PION_STATIC_LINKING,并且从另一个关于我发现的另一个库的帖子中我可能需要在我的程序中定义PION_STATIC_LINKING。

Doing so yields a few 100 errors along the following template: 这样做会在以下模板中产生几个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

I tried to use /NODEFAULTLIB:libcmt but I still get errors that say certain functions already defined in pion-common.lib / pion-net.lib. 我试图使用/ NODEFAULTLIB:libcmt,但我仍然得到错误,说明已经在pion-common.lib / pion-net.lib中定义了某些函数。

Any ideas? 有任何想法吗? :( :(

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. 这很可能是因为您使用/ MT(多线程)设置代码生成来编译项目,而pion网络库是使用/ MD(多线程DLL)编译的,反之亦然。 Try changing your configuration to /MD if it's /MT or vice-versa. 尝试将配置更改为/ MD(如果是/ MT),反之亦然。 To do this, go to Project -> <ProjectName> Properties... -> Configuration Properties -> C/C++ -> Code Generation . 要执行此操作,请转到Project -> <ProjectName> Properties... -> Configuration Properties -> C/C++ -> Code Generation In the right panel you should be able to see the setting Runtime Library . 在右侧面板中,您应该能够看到设置Runtime Library Change the options there and rebuild your whole solution. 更改那里的选项并重建整个解决方案。

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

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