连接错误与升压1.60和VS 2013在x64 [英] Linker error with Boost 1.60 and VS 2013 on x64

查看:333
本文介绍了连接错误与升压1.60和VS 2013在x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 的#include<&iostream的GT;
#包括LT&;升压/定时器/ timer.hpp>诠释的main()
{
    提高::计时器:: auto_cpu_timer秒;
    性病::法院LT&;< 你好,世界! <<的'\\ n';
    返回0;
}

此编译上面提到的code在QT与MSVC 12.0 x64和它引发以下错误:

  libboost_timer-VC120-MT-GD-1_60.lib(cpu_timer.obj):错误LNK2019:​​无法解析的外部符号公用:静态类boost ::时辰:: time_point<类boost ::时辰:: steady_clock,类boost ::时辰::持续时间LT; __的Int64,类boost ::比率LT; 1,1000000000>>> __cdecl提振::时辰:: steady_clock ::现在(无效) (?now@steady_clock@chrono@boost@@SA?AV?$time_point@Vsteady_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0DLJKMKAA@@boost@@@23@@23@XZ)在函数引用无效__cdecl`匿名命名空间':: get_cpu_times(结构的boost ::计时器:: cpu_times&安培;)(?get_cpu_times @ A0x0d396f6a @@ YAXAEAUcpu_times @计时器@提升@@@ Z)
调试\\将Test.exe:致命错误LNK1120:1无法解析的外部

升压已在架构x86和使用下面的命令行参数地址模型64编译 -

  B2工具= MSVC 12.0  -  preFIX =<地点> --build型=完整--abbreviate路径架构= 86的地址模型= 64安装-j4

此外,与32位MSVC 2013编译器编译程序运行正常,而且我在使用Qt创建者。这是我的项目文件的内容 -

 模板=应用
CONFIG + =控制台C ++ 11
CONFIG - = app_bundle
CONFIG - = QTSOURCES + = main.cpp中
的win32:CONFIG(释放,调试|发布):LIBS + =-LD:/升压/ boost_1_60_0 /台/ lib中/-llibboost_system-VC120-MT-1_60 -llibboost_filesystem-VC120-MT-1_60 -llibboost_timer-VC120-MT -1_60
其他:Win32的:CONFIG(调试,调试|发布):LIBS + =-LD:/升压/ boost_1_60_0 /台/ lib中/-llibboost_system-VC120-MT-GD-1_60 -llibboost_filesystem-VC120-MT-GD-1_60 -llibboost_timer-VC120-MT-GD-1_60
其他:UNIX:LIBS + =-LD:/升压/ boost_1_60_0 /台/ lib中/-llibboost_system-VC120-MT-1_60 -llibboost_filesystem-VC120-MT-1_60 -llibboost_timer-VC120-MT-1_60INCLUDEPATH + = D:/升压/ boost_1_60_0 /


解决方案

我刚刚的究竟的在VS2015同样的问题。

我的解决方案是:

 的#include<升压/ chrono.hpp>

希望这有助于别人!

#include <iostream>
#include <boost/timer/timer.hpp>

int main()
{
    boost::timer::auto_cpu_timer s;
    std::cout << "Hello World!" << '\n';
    return 0;
}

Compiled this above mentioned code in qt with msvc 12.0 x64 and it throws the following error:

libboost_timer-vc120-mt-gd-1_60.lib(cpu_timer.obj) : error LNK2019: unresolved external symbol "public: static class boost::chrono::time_point<class boost::chrono::steady_clock,class boost::chrono::duration<__int64,class boost::ratio<1,1000000000> > > __cdecl boost::chrono::steady_clock::now(void)" (?now@steady_clock@chrono@boost@@SA?AV?$time_point@Vsteady_clock@chrono@boost@@V?$duration@_JV?$ratio@$00$0DLJKMKAA@@boost@@@23@@23@XZ) referenced in function "void __cdecl `anonymous namespace'::get_cpu_times(struct boost::timer::cpu_times &)" (?get_cpu_times@?A0x0d396f6a@@YAXAEAUcpu_times@timer@boost@@@Z)
debug\Test.exe : fatal error LNK1120: 1 unresolved externals

Boost has been compiled in architecture x86 and address model 64 with the following command line argument-

b2 toolset=msvc-12.0 --prefix=<location> --build-type=complete --abbreviate-paths architecture=x86 address-model=64 install -j4

Also, the program runs fine when compiled with 32 bit msvc 2013 compiler, and I am using Qt Creator. This is the content of my project file -

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp


win32:CONFIG(release, debug|release): LIBS += "-LD:/boost/boost_1_60_0/stage/lib/" -llibboost_system-vc120-mt-1_60 -llibboost_filesystem-vc120-mt-1_60 -llibboost_timer-vc120-mt-1_60
else:win32:CONFIG(debug, debug|release): LIBS += "-LD:/boost/boost_1_60_0/stage/lib/" -llibboost_system-vc120-mt-gd-1_60 -llibboost_filesystem-vc120-mt-gd-1_60 -llibboost_timer-vc120-mt-gd-1_60
else:unix: LIBS += "-LD:/boost/boost_1_60_0/stage/lib/" -llibboost_system-vc120-mt-1_60 -llibboost_filesystem-vc120-mt-1_60 -llibboost_timer-vc120-mt-1_60 

INCLUDEPATH += D:/boost/boost_1_60_0/

解决方案

I just had exactly the same issue in VS2015.

The solution for me was to:

#include <boost/chrono.hpp>

Hope this helps somebody else!

这篇关于连接错误与升压1.60和VS 2013在x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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