gpt4 book ai didi

c++ - 将 POCO 静态库嵌入另一个

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:23:40 27 4
gpt4 key购买 nike

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

四处寻找,我找到了这个 article (参见“用其他静态库构建静态库”一节)但是引用这个案例,我不明白为什么会这样。

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

问候,
丹妮尔

最佳答案

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

关于c++ - 将 POCO 静态库嵌入另一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15872889/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com