4

我正在使用 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 /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

环顾四周,我找到了这篇文章 (参见“使用其他静态库构建静态库”部分),但提到这个案例,我不明白为什么会发生这种情况。

这个警告可能是我的问题的原因吗?

问候,
丹尼尔

4

2 回答 2

0

VS 2010 中似乎更改了该功能。自 VS 2010 以来,您尝试做的似乎不起作用。有关更多详细信息,请参阅此问题和相关MSDN 博客。我没有第一手的经验,但是make-it-so提供了一个据称可以做你想做的事情的工具。

于 2013-04-09T02:44:19.267 回答
0

我可能错了,但是您是否将 *.lib 文件放入您的项目D:\src\MySDK\win32\VS2010如果不是将它们放入您的项目中。

于 2013-04-08T06:54:35.713 回答