Den*_*lin 10 c++ compiler-construction boost
我尝试使用g ++ 4.4在Debian上的远程服务器上使用boost库编译小的.cpp文件.我为此目的使用Netbeans.我的家用机器在Windows 7上.解决了链接下一个代码的一些问题
#include <boost/timer/timer.hpp>
#include <iostream>
#include <string>
int main()
{
boost::timer::auto_cpu_timer ac; //line 5
return 0; //line 6
}
Run Code Online (Sandbox Code Playgroud)
产生2个错误:
第5 undefined reference to boost::timer::auto_cpu_timer::auto_cpu_timer(short)'
行:第6行:undefined reference to boost::timer::auto_cpu_timer::~auto_cpu_timer()'
如果我使用标题boost/thread.hpp但是对于线程构造函数/析构函数,结果相同.但是例如boost/shared_ptr编译没有任何问题.在neatbeans中的结果编译命令是
g++ -m64 -I/usr/include/boost/boost_1_49_0 -lboost_system -o dist/Debug/GNU-Linux-x86/test build/Debug/GNU-Linux-x86/main.o
-L/usr/include/boost/boost_1_49_0/stage/lib -Wl,-rpath /usr/include/boost/boost_1_49_0/stage/lib build/Debug/GNU-Linux-x86/main.o
Run Code Online (Sandbox Code Playgroud)
我错过了什么?