我想编译升压计时器,它是抛出错误,我不明白。它让我觉得定时器库在atm处被破坏:升压计时器不编译
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/timer/timer.hpp>
int main(int argc, char **argv) {
// auto_cpu_timer t;
std::cout << boost::lexical_cast<std::string>(2.0) << std::endl;
return 0;
}
没有#include for timer.hpp它编译。有了它,它会抛出以下错误:
Invoking: GCC C++ Linker
g++ -Lsrc -o "timetest" ./src/main.o
./src/main.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [timetest] Error 1
这是否意味着计时器库被摧毁atm?我正在使用Boost 1.49.0。
谢谢!
难道真的要求太多了一点谷歌福?我们在这里有数千个“未定义的参考”问题。他们都是一样的。 – pmr 2012-04-06 14:14:04
您是否直接复制粘贴该程序,或者是否输入了该程序?你好像至少错过了'#include'。 –
2012-04-06 14:14:49
@pmr我做了几分钟的谷歌和stackoverflow,但我的查询过于具体,我猜。我的错! – 2012-04-06 14:19:36