你好我試圖升壓日誌簡單的例子,用的mingw32在Windows 8和鏈接我得到鏈接錯誤:MINGW32升壓登錄鏈接錯誤:InterlockedCompareExchange
Log.cpp
#include <boost/log/trivial.hpp>
int main()
{
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
}
而且我運行下面的編譯和鏈接命令
gcc -Wall -g -static -I./../../boost_1_56_0/ Log.cpp -o Log.exe -L./../../boost_1_56_0/stage/lib/ -lboost_log-mgw48-mt-1_56 -lboost_thread-mgw48-mt-1_56 -lboost_system-mgw48-mt-1_56 -lstdc++
而且,我發現了以下錯誤:
C:\SpellSpindle\GelatinousEngine\BoostHelloWorld\Log>mingw32-make
g++ -Wall -g -static -I./../../boost_1_56_0/ Log.cpp -o Log.exe -L./../../boost_
1_56_0/stage/lib/ -lboost_log-mgw48-mt-1_56 -lboost_thread-mgw48-mt-1_56 -lboost
_system-mgw48-mt-1_56 -lstdc++
./../../boost_1_56_0/stage/lib/\libboost_thread-mgw48-mt-1_56.a(thread.o):thread
.cpp:(.text$_ZN5boost6detail5win3223GetTickCount64emulationEv+0x1e): undefined r
eference to `_InterlockedCompareExchange'
./../../boost_1_56_0/stage/lib/\libboost_thread-mgw48-mt-1_56.a(thread.o):thread
.cpp:(.text$_ZN5boost6detail5win3223GetTickCount64emulationEv+0x77): undefined r
eference to `_InterlockedCompareExchange'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./../../bo
ost_1_56_0/stage/lib/\libboost_thread-mgw48-mt-1_56.a(thread.o): bad reloc addre
ss 0x77 in section `.text$_ZN5boost6detail5win3223GetTickCount64emulationEv'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Makefile:15: recipe for target 'all' failed
mingw32-make: *** [all] Error 1
我一直試圖讓這個鏈接幾天,並沒有發現任何在互聯網上發佈的修復鏈接錯誤。
任何人都可以幫忙嗎?
我有明確的4.8.1。我爲mingw 4.8構建了boost庫,但是我將它們重建爲4.8.1,但它們仍然不能編譯,給出了相同的錯誤。 – Anytime0 2014-10-06 22:21:03
我用「boostrap mingw」,「bjam --toolset = gcc-4.8.1 --build-type = complete」構建它們。有沒有其他的方法來構建它們,可以用於mingw 4.8.1?我嘗試安裝Mingw-W64,但安裝時收到「Error Res」消息。它不會安裝任何我可以編譯的東西。我發現有一個向後兼容性錯誤,但是我第一次嘗試構建和使用boost是與mingw 4.8.1。問題仍然是向後兼容還是其他問題? – Anytime0 2014-10-06 22:27:22
你在說明明4.8破壞了增強版本,但現在有什麼辦法可以使用嗎?它還是壞了嗎? – Anytime0 2014-10-06 22:37:09