Mingw32 Boost日志链接错误:InterlockedCompareExchange [英] Mingw32 Boost Log Link Errors: InterlockedCompareExchange

查看:162
本文介绍了Mingw32 Boost日志链接错误:InterlockedCompareExchange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Boost Log简单示例与Windows 8上的mingw32链接,但出现链接错误:

Hi I'm trying to link a Boost Log simple example with mingw32 on Windows 8 and I'm getting link errors:

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";
}

我正在运行以下编译和链接命令

And I'm running the following compile and link command

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

我已经尝试将其链接几天了,却没有发现互联网上发布的任何可解决链接错误的信息.

I've been trying to get this to link for days and haven't found anything posted on the internet that fix the link errors.

任何人都可以帮忙吗?

推荐答案

Mingw-W64的安装程序无法正常工作,但是在我从存储库中手动下载该程序后,我可以使该工作正常.我为mingw版本4.9.1重建了boost库,然后它确实链接到了新库.非常感谢!呜呼!

The installer for Mingw-W64 didn't work but after I downloaded it from the repository manually I was able to get the thing working. I rebuilt the boost libraries for mingw version 4.9.1 and then it did link to the new libraries. Thank you greatly! Woohoo!

这篇关于Mingw32 Boost日志链接错误:InterlockedCompareExchange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆