g ++ 4.4を使用してDebianのリモートサーバ上のブーストライブラリで小さい.cppファイルをコンパイルしようとしました。私はこの目的のためにNetbeansを使用します。私は、ヘッダboost/thread.hpp
を使用する場合undefined reference to boost::timer::auto_cpu_timer::~auto_cpu_timer()'
boost :: timer :: auto_cpu_timerへの未定義の参照
同じ結果:
行5:undefined reference to boost::timer::auto_cpu_timer::auto_cpu_timer(short)'
ライン6マイホームマシンが2つのエラーを生成し、次のコード
#include <boost/timer/timer.hpp>
#include <iostream>
#include <string>
int main()
{
boost::timer::auto_cpu_timer ac; //line 5
return 0; //line 6
}
をリンクして、いくつかの問題を解決した後に、Windows 7上でスレッドコンストラクタ/デストラクタ用です。 しかし、例えば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
のですか?
ありがとう、私は本当にそれを逃した。 –
-lboost_system(https://stackoverflow.com/q/41980440/を参照)が必要な場合もあります。 – ricab