x64 上的 Boost 1.60 和 VS 2013 的链接器错误
Linker error with Boost 1.60 and VS 2013 on x64
#include <iostream>
#include <boost/timer/timer.hpp>
int main()
{
boost::timer::auto_cpu_timer s;
std::cout << "Hello World!" << 'n';
return 0;
}
使用 msvc 12.0 x64 在 qt 中编译了上述代码,并抛出以下错误:
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)
debugTest.exe : fatal error LNK1120: 1 unresolved externals
Boost 已在架构 x86 中编译,并使用以下命令行参数解决模型 64-
b2 toolset=msvc-12.0 --prefix=<location> --build-type=complete --abbreviate-paths architecture=x86 address-model=64 install -j4
此外,当使用32位msvc 2013编译器编译时,该程序运行良好,并且我正在使用Qt Creator。这是我的项目文件的内容 -
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/
我在VS2015中遇到了完全相同的问题。
我的解决方案是:
#include <boost/chrono.hpp>
希望这对其他人有所帮助!
相关文章:
- 将"libpqxx"与Visual Studio 2013链接/安装,以便与PostgrSQL建立C++连接
- OpenGL GLut 与 Windows 8 64 位上的 Visual Studio 2013 链接问题
- 与openCV的vs 2013中的lib链接
- 在Visual Studio 2013终极项目中使用FFMPEG,链接错误LNK2019
- 如何在Visual Studio 2013的C++项目中编译和链接谷歌测试,但使用NuGet Package Manag
- MS Visual Studios链接错误.2010年和2013年
- 在Visual Studio 2013中使用Qt和OpenCV创建应用程序链接问题
- Visual Studio 2013 - 如何在我自己的库中链接/包含其他库
- Qt 5.4 静态构建在 Visual Studio 2013 中产生"unresolved external symbol"链接错误
- x64 上的 Boost 1.60 和 VS 2013 的链接器错误
- 提升 1.57.0 程序选项 MSVS 2013 链接器错误
- 尝试引用Visual Studio 2013中的静态库项目时发生链接器错误
- Boost Python类导出无法编译,visual studio 2013中出现链接错误
- matlab R2013a与MS VC++2013之间的链接错误
- Visual Studio 2013 Professional链接器错误
- Visual Studio 2013:自定义枚举的链接器错误
- 在使用visual studio 2013在win7上构建opengl项目时遇到链接错误
- Visual Studio 2013 Boost-log v1_61_0链接错误
- 视觉工作室 - 编译C++程序时VS 2013中的链接时间错误 - B. Stroustrup的PPP使用C++:第8章 - Q1 钻探?
- Microsoft Visual Studio 2013链接错误1104