将POCO静态库嵌入另一个

时间:2013-04-08 06:47:31

标签: c++ static-linking poco-libraries

我正在使用Poco开发SDK(作为动态和静态库),我想将Poco静态库嵌入到我的库中,以避免最终用户设置和链接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文件夹中 但是这个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

搜索周围,我发现了这个article(参见“使用其他静态库构建静态库”一节)但是参考这个案例,我不明白为什么会发生这种情况。

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

的问候,
丹尼尔

2 个答案:

答案 0 :(得分:0)

我可能错了,但你把* .lib文件放到你的项目 D:\ src \ MySDK \ win32 \ VS2010 中,如果没有把它们放到你的项目中。

答案 1 :(得分:0)

似乎VS 2010中的功能已更改。自VS 2010以来,您尝试执行的操作似乎无效。有关详细信息,请参阅this question及相关MSDN blog。我没有第一手经验,但是make-it-so提供了一种据称可以做你想做的工具。