问题在Windows 7链接升压日志1_60使用MinGW [英] Problems Linking boost log 1_60 with MinGw on Windows 7
问题描述
On upgrading to boost 1.60.0 some applications are failing to link with boost log when built with MinGw 4.9.2 on Windows 7.
我得到以下链接错误:
undefined reference to `_imp___ZN5boost3log9v2_mt_nt67trivial6logger3getEv'
undefined reference to `_imp___ZN5boost3log9v2_mt_nt63aux15stream_providerIcE17allocate_compoundERNS1_6recordE'
undefined reference to `_imp___ZN5boost3log9v2_mt_nt63aux25unhandled_exception_countEv'
undefined reference to `_imp___ZN5boost3log9v2_mt_nt611record_view11public_data7destroyEPKS3_'
bad reloc address 0x1 in section `.text$_ZNK5boost4asio5error6detail13misc_category4nameEv[__ZNK5boost4asio5error6detail13misc_category4nameEv]'
请注意:BOOST_LOG_DYN_LINK定义:
Note: BOOST_LOG_DYN_LINK is defined:
g++ -c -pipe -fno-keep-inline-dllexport -Wall -Wextra -Wpedantic -Ofast -std=c++1y -frtti -fexceptions -mthreads -DUNICODE -DLOGGING_ENABLED -DNTDDI_VERSION=NTDDI_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -DBOOST_THREAD_USE_LIB=1 -DBOOST_LOG_DYN_LINK=1
升压1.60.0生成日志文件显示,这两个升压日志,并没有任何错误或警告,包括一些它的失败与例如链接文件的助推log_setup建:
The boost 1.60.0 build log file shows that both boost log and boost log_setup built without any errors or warnings, including some of the files that it's failing to link with e.g.:
gcc.compile.c++ bin.v2\libs\log\build\gcc-mingw-4.9.2\release\threading-multi\trivial.o
gcc.compile.c++ bin.v2\libs\log\build\gcc-mingw-4.9.2\release\threading-multi\unhandled_exception_count.o
在应用程序中使用升压1.59.0使用MinGW 4.9.2链接确定在Windows 7上,也使用boost 1.60.0用gcc 5.1.1链接确定在Fedora 23。
The applications link OK using boost 1.59.0 with MinGw 4.9.2 on Windows 7 and also link OK using boost 1.60.0 with gcc 5.1.1 on Fedora 23.
助推ASIO 以来没有改变提振1.58.0。那么,在提振登录之间提高1.59.0和1.60.0提振造成MinGW的连接失败在Windows?
boost asio hasn't changed since boost 1.58.0. So what's changed in boost log between boost 1.59.0 and boost 1.60.0 to cause MinGw linking to fail on Windows?
推荐答案
Boost.Log很可能比你的应用程序不同的选择而建,所以它有一个不同的版本命名空间。看看与的Dependency Walker 导出的符号和看到的描述。我怀疑,差别将在命名空间的OS API组件,为目标Windows版本具有的在1.60改变。你建立你的应用程序为Windows 7而Boost.Log为Windows XP最有可能建成。
Boost.Log was probably built with different options than your application, so it has a differently named version namespace. Have a look at the exported symbols with Dependency Walker and see the description. I suspect, the difference will be in the OS API component of the namespace, as the setup of the target Windows version has changed in 1.60. You're building your application for Windows 7 while Boost.Log is most likely built for Windows XP.
当你识别的差异,必须更正升压建筑选项和重建加速。例如。到目标Windows版本设置为7定义 BOOST_USE_WINAPI_VERSION
到 0x0601
。如果你不希望改变Windows版本升压是针对,您可以定义 BOOST_USE_WINAPI_VERSION
到 0x0501
而构建应用程序,以表明要推动继续指定XP即使你的应用程序的目标是7。
When you identify the difference, you have to correct Boost building options and rebuild Boost. E.g. to set target Windows version to 7 define BOOST_USE_WINAPI_VERSION
to 0x0601
. If you don't want to change Windows version Boost is targeted for, you can define BOOST_USE_WINAPI_VERSION
to 0x0501
while building your application, indicating that you want Boost to keep targeting XP even though your application is targeting 7.
这篇关于问题在Windows 7链接升压日志1_60使用MinGW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!