C++ 将POCO静态库嵌入到另一个库中
我正在使用Poco开发一个SDK(作为动态和静态库),我希望将Poco静态库嵌入到我的SDK中,以避免最终用户设置和链接Poco环境。 MySDKd.LIB的C/C++设置为:C++ 将POCO静态库嵌入到另一个库中,c++,static-linking,poco-libraries,C++,Static Linking,Poco Libraries,我正在使用Poco开发一个SDK(作为动态和静态库),我希望将Poco静态库嵌入到我的SDK中,以避免最终用户设置和链接Poco环境。 MySDKd.LIB的C/C++设置为: /I"..\..\..\include" /I"..\..\..\src" /I"D:\lib\boost_1_53_0\" /I"..\..\..\thirdparty" /I"..\..\..\thirdparty\protobuf\include\" /ZI /nologo /W3 /WX- /Od /O
/I"..\..\..\include"
/I"..\..\..\src"
/I"D:\lib\boost_1_53_0\"
/I"..\..\..\thirdparty"
/I"..\..\..\thirdparty\protobuf\include\"
/ZI /nologo /W3 /WX- /Od /Oy-
/D "WIN32" /D "_DEBUG" /D "_LIB"
/D "WIN32_LEAN_AND_MEAN" /D "_MBCS"
/D "POCO_STATIC" /D "POCO_NO_AUTOMATIC_LIBS"
/D "IBPP_WINDOWS"
/Gm /EHa /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope
/Fp"Debug\MySDKd.pch" /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb"
/Gd /analyze- /errorReport:queue
链接器设置为:
/OUT:"D:\src\MySDK\win32\VS2010\..\..\..\bin\static\MySDKd.lib"
"libprotobufd.lib"
"PocoFoundationmdd.lib"
"PocoUtilmdd.lib"
"PocoNetmdd.lib"
"PocoXMLmdd.lib"
/LIBPATH:"D:\lib\boost_1_53_0\stage\lib"
/LIBPATH:"D:\lib\poco-1.5.1-all\lib"
/LIBPATH:"D:\src\MySDK\lib"
/NOLOGO /NODEFAULTLIB
现在,当我构建一个简单的测试项目(使用sdk)时,我得到了链接器错误:
LINK : fatal error LNK1104: cannot open file 'PocoFoundationmdd.lib'
除非我将Poco\lib文件夹添加到测试项目的链接器路径中。但是这个库现在应该是我的MySDKd.lib的一部分,对吗?
此外,当我构建SDK时,我收到以下链接器警告:
PocoFoundationmdd.lib(ByteOrder.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(String.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(SignalHandler.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(WS2_32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in PocoFoundationmdd.lib(IPHLPAPI.DLL); second definition ignored
PocoFoundationmdd.lib(WS2_32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoXMLmdd.lib(XMLString.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
在四处搜索时,我发现了这一点(请参阅“使用其他静态库构建静态库”一节),但提到这个案例,我不明白为什么会发生这种情况
这个警告可能是我的问题的原因吗
问候,Daniele我可能错了,但您是否将*.lib文件放入了您的项目中D:\src\MySDK\win32\VS2010如果不将它们放入您的项目中。在VS 2010中,功能似乎发生了更改。自VS 2010以来,您尝试做的似乎不起作用。有关更多详细信息,请参阅和相关。我没有这方面的第一手经验,但提供了一个据称可以做你想做的事情的工具。我认为这不会解决问题。lib的路径已在链接器属性页中指定。您好@Alex,很抱歉我的回答太晚,但我切换到另一个项目有一段时间。此外,我尝试在后期生成中使用lib命令(如您建议的页面中所示),但它不起作用。我也不知道怎么做才能帮助我。我还没有找到解决办法!