提问人:IcePic 提问时间:10/9/2013 更新时间:10/9/2013 访问量:292
Boost::Log/mingw64 未定义引用
Boost::Log/mingw64 Undefined reference
问:
我在使用Boost_1_54版本的Boost::Log库时遇到问题 在 Windows7 下使用 mingw-w64 gcc-4.8.1。我可以在没有的情况下编译 boost 任何问题,但我无法正确链接以下程序。
#include <boost/log/trivial.hpp>
int main(int, char*[])
{
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";
return 0;
}
我使用以下命令来编译/链接程序
g++ -DBOOST_LOG_DYN_LINK log.cpp
-IC:\\Build\\Libs\\bin64\\boost\\include
-LC:\\Build\Libs\\bin64\\boost\\lib
-lpthread
-lboost_thread-mgw48-mt-1_54
-lboost_system-mgw48-1_54
-lboost_log-mgw48-1_54
-lboost_log_setup-mgw48-1_54
-lboost_filesystem-mgw48-1_54 -o loga.exe
错误如下所示:
C:\Users\buck\AppData\Local\Temp\ccvYpCEb.o:log.cpp:(.text+0x37): undefined refe
rence to `__imp__ZN5boost3log9v2_mt_nt57trivial6logger3getEv'
C:\Users\buck\AppData\Local\Temp\ccvYpCEb.o:log.cpp:(.text+0x7f): undefined refe
rence to `__imp__ZN5boost3log9v2_mt_nt57trivial6logger3getEv'
c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-
mingw32/bin/ld.exe: C:\Users\buck\AppData\Local\Temp\ccvYpCEb.o: bad reloc addre
ss 0x0 in section `.pdata$_ZNSt11char_traitsIcE6lengthEPKc'
collect2.exe: error: ld returned 1 exit status
在 linux 下,我可以毫无问题地运行示例。我还尝试了不同顺序的库。 但结果是一样的。
有没有人知道如何运行它或如何继续以找到问题? 我现在正在尝试三个小时,我不知道下一步该怎么做。
问候
凯文
答: 暂无答案
评论