簡體   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