我也跟着下面的步驟,以建立CppDB:CppDB編譯錯誤
svn co http://cppcms.svn.sourceforge.net/svnroot/cppcms/cppdb/trunk cppdb-trunk
cd cppdb-trunk
cmake ~/Desktop/cppdb-trunk
make
make install
之後,我試圖編譯並運行該文件example1.cpp從examples目錄。
當我運行gcc example1.cpp
我得到以下錯誤:
/tmp/ccGWenrv.o:在功能
main': example1.cpp:(.text+0x2a): undefined reference to
的std ::分配器::分配器()」 example1.cpp :(文字+的0x42。 ):未定義引用std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)' example1.cpp:(.text+0x58): undefined reference to
cppdb :: session :: session(std :: __ cxx11 :: basic_string,std :: allocator> const &)' example1.cpp :(.text + 0x64):undefined指向std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()' example1.cpp:(.text+0x73): undefined reference to
std :: allocator ::〜allocator()' example1.cpp :(。text + 0x91):undefined指向cppdb::session::operator<<(char const*)' example1.cpp:(.text+0xa5): undefined reference to
cppdb :: statement :: operator < <(無效()(cppdb ::聲明&)) ' example1.cpp :(文字+ 0xb4):未定義參考cppdb::statement::~statement()' example1.cpp:(.text+0xd2): undefined reference to
cppdb ::會議::操作< <(字符常量)' example1.cpp :(。text + 0xe6):未定義的引用cppdb::statement::operator<<(void (*)(cppdb::statement&))' example1.cpp:(.text+0xf5): undefined reference to
cppdb :: statement ::〜statement()' example1.cpp :(。text + 0x170):undefined引用cppdb::statement::statement()' example1.cpp:(.text+0x18e): undefined reference to
cppdb :: session :: operator < <(char const char *)' example1.cpp :(。text + 0x1db):未定義的引用cppdb::statement::operator<<(tm const&)' example1.cpp:(.text+0x1e8): undefined reference to
cppdb :: statement :: operator < <(char const *)' example1.cpp :(。text + 0x1fd):undefined reference to `cppdb ::聲明::運算符= (cppdb ::聲明常量&)」
等
有什麼建議?
您需要使用'g ++'編譯'C++'文件。 'gcc'採用'C'語言。 'g ++ example1.cpp'它顯示了什麼? – dlmeetei