Poco作为具有动态运行时的静态库需要导入DLL库吗?

Poco as static library with dynamic runtime requires import library of DLL?

我正在尝试在我的项目中将 Poco 用作具有动态运行时的静态库。我已经下载了 Poco 1.7.3 的完整源代码,并使用 buildwin.bat 脚本编译库,使用我自己编译的 OpenSSL 1.0.2h 共享库(即调整 buildwin.bat 中的路径)。

通过 buildwin.bat 140 build static_md debug Win32 nosamples notests msbuild 生成 PocoXYZmd.lib 工作正常。

但是,当我在自己的项目中尝试 link 反对 PocoXYZmd.lib 时,linker 搜索 PocoXYZ.lib,[=16= 的导入库].

使用 shared 构建 Poco 并在 linker 搜索路径中提供 PocoXYZ.lib 导入库,我在已经定义的 Poco 符号上遇到错误(很明显)。

我是不是遗漏了一些重要的东西,还是 Poco 构建脚本中的错误?


我已将 Poco 配置为仅构建以下组件:Foundation、XML、JSON、Util、Net、Crypto、NetSSL_OpenSSL。

此外,我不得不调整 v140 vcxproj-Crypto 文件和 NetSSL_OpenSSL 到 link 到 libeay32.libssleay32.lib(导入OpenSSL DLL 的库)而不是 libeay32md.libssleay32md.lib(根据 OpenSSL 1.0.2h 构建脚本,不知道这些来自哪里)。

我在 Windows 7 上使用 Visual Studio 2015 Update 2,在 32 位 Visual Studio 开发人员提示中执行所有操作。

看了re-reading Poco文档,终于找到了解决办法:

在 Windows 上静态使用 Poco 时,必须在使用 Poco 编译 library/application 时指定 POCO_STATIC,否则 Poco headers 中的几个 #pragma comment 指令将默默地强制链接到 Poco 的 DLL 版本。

http://pocoproject.org/docs/99150-WindowsPlatformNotes.html

谢谢,RTFM。