繁体   English   中英

构建Boost动态链接会产生链接错误吗?

[英]Building Boost dynamically linkable gives linking error?

我正在尝试构建boost并生成dll,但无论我做了什么都没有解决问题。

在这里我得到了:

创建库bin.v2 \\ libs \\ thread \\ build \\ msvc-11.0 \\ dbg \\ adrs-mdl-32 \\ async-excpt-on \\ thrd-mlt \\ boost_thread-vc110-mt-gd-1_53.lib和object bin.v2 \\ libs \\ thread \\ build \\ msvc-11.0 \\ dbg \\ adrs-mdl-32 \\ async-excpt-on \\ thrd-mlt \\ boost_thread-vc110-mt-gd-1_53.exp thread.obj:错误LNK2019:未解析的外部符号“__declspec(dllimport)public:__ thiscall boost :: gregorian :: greg_month :: greg_month(unsigned short)”(_ imp ?? 0greg_month @ gregorian @ boost @@ QAE @ G @ Z)在函数“public:__thiscall boost: :gregorian :: date :: date(enum boost :: date_time :: special_values)“(?? 0date @ gregorian @ boost @@ QAE @ W4special_values @ date_time @ 2 @@ Z)thread.obj:错误LNK2019:未解析的外部符号“__declspec(dllimport)public:__ thiscall boost :: gregorian :: greg_month :: operator unsigned short(void)const”(_ imp ?? Bgreg_month @ggorgorian @ boost @@ QBEGXZ)函数__catch $?make_external_thread_data @?A0x9b8c45f0 @ boost @@ YAXXZ $ 0 bin.v2 \\ libs \\ thread \\ build \\ msvc-11.0 \\ dbg \\ adrs-mdl-32 \\ async-excpt-on \\ thrd-mlt \\ boost_ thread-vc110-mt-gd-1_53.dll:致命错误LNK1120:2个未解析的外部

这里有一些关于设置的信息:

操作系统:W7 x64

构建命令:

b2 -j%NUMBER_OF_PROCESSORS% - 简称路径工具集= msvc-11.0 define = _SECURE_SCL = 0 define = _CRT_SECURE_NO_DEPRECATE define = _CRT_SECURE_NO_WARNINGS --without-mpi address-model = 32 variant = debug install link = shared runtime-link = shared threading = multi asynch-exceptions = on exception-handling = on extern-c-nothrow = off --prefix = .. \\ boost cd ..

我已将CYGWin安装到计算机上。

这是我到现在为止所尝试的;

*我试图在32位命令窗口中构建它(我使用jenkins来构建boost)

*我在boost config / user.hpp中写了#define BOOST_ALL_DYN_LINK

*我在boost config / user.hpp中写了#define BOOST_ALL_NO_LIB

以前是否有人遇到过这样的问题? 我真的找不到任何地方的东西?


编辑:

有关于我的问题的更新。 我可以构建它以便发布。 我唯一改变的是这里:

b2 -j%NUMBER_OF_PROCESSORS%--abbreviate-paths toolset = msvc-11.0 define = _SECURE_SCL = 0 define = _CRT_SECURE_NO_DEPRECATE define = _CRT_SECURE_NO_WARNINGS --without-mpi address-model = 32 variant = release install link = shared runtime-link = shared threading = multi asynch-exceptions = on exception-handling = on extern-c-nothrow = off --prefix = .. \\ boost cd ..

可能是什么问题呢? 我该如何解决?

提前感谢任何建议。

其实我找到了解决方案:

我使用bjam的方式是正确的,足以动态地构建boost。 在那个阶段,我不应该定义任何东西。 编译后,我更改了user.hpp和#define BOOST_ALL_DYN_LINK。 这样我自己的项目(使用boost)将理解提升是动态的。 这就是应该如何建立助推器的方式。

这似乎是最好的方法,因为boost会按预期自动解码必要的lib和dll并且运行良好。

我看到实现成功的boost构建需要很多手动步骤。 如果您不想通过这些手动步骤并避免开销,请尝试使用BlueGo ,前提是您要使用MSVC工具集。 BlueGo允许配置32/64位,调试/释放模式等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM