我正在爲我的項目使用C++ webframework。 我正在嘗試將身份驗證添加到gitmodel示例。與Wt示例相結合的鏈接錯誤
我收到以下錯誤:
../hangman/CMakeFiles/hangman.wt.dir/Session.o: In function `Session::Session()': /home/s/Downloads/wt-3.2.3/examples/hangman/Session.C:101: undefined reference to `void Wt::Dbo::Session::mapClass<User>(char const*)'
../hangman/CMakeFiles/hangman.wt.dir/Session.o: In function `Wt::Auth::Dbo::AuthInfo<User>::user() const': /home/s/Downloads/wt-3.2.3/src/Wt/Auth/Dbo/AuthInfo:94: undefined reference to `Wt::Dbo::ptr<User>::ptr(Wt::Dbo::ptr<User> const&)'
../hangman/CMakeFiles/hangman.wt.dir/Session.o: In function `Session::user() const': /home/s/Downloads/wt-3.2.3/examples/hangman/Session.C:138: undefined reference to `Wt::Dbo::ptr<User>::operator bool() const'
/home/s/Downloads/wt-3.2.3/examples/hangman/Session.C:139: undefined reference to `User::User()'
/home/s/Downloads/wt-3.2.3/examples/hangman/Session.C:139: undefined reference to `Wt::Dbo::ptr<User> Wt::Dbo::Session::add<User>(User*)'
/home/s/Downloads/wt-3.2.3/examples/hangman/Session.C:139: undefined reference to `Wt::Dbo::ptr<User>::operator=(Wt::Dbo::ptr<User> const&)'
完整的錯誤列表:http://pastie.org/5469803
我試圖使用生成的makefile CMake的。追查下來後,發現這個鏈接器錯誤是在CMakeFiles目錄下運行link.txt之後發生的。 我試圖將gitmodel示例和hangman示例的link.txt結合起來,因爲hangman也進行身份驗證。 這裏是我的link.txt:
/usr/bin/c++ -O2 -g ../hangman/CMakeFiles/hangman.wt.dir/Session.o CMakeFiles/gitview.wt.dir/Git.o CMakeFiles/gitview.wt.dir/GitModel.o CMakeFiles/gitview.wt.dir/__/wt-homepage/SourceView.o CMakeFiles/gitview.wt.dir/GitView.o -o gitview.wt -rdynamic -L/home/s/Downloads/wt-3.2.3/build/src/http -L/home/s/Downloads/wt-3.2.3/build/src -L/home/s/Downloads/wt-3.2.3/build/src/Wt/Dbo -L/home/s/Downloads/wt-3.2.3/build/src/Wt/Dbo/backend -lcrypt -L/usr/local/lib ../../src/http/libwthttp.so.3.2.3 ../../src/libwt.so.3.2.3 ../../src/Wt/Dbo/libwtdbo.so.3.2.3 ../../src/Wt/Dbo/backend/libwtdbosqlite3.so.3.2.3 /usr/local/lib/libboost_filesystem.so /usr/local/lib/libboost_random.so /usr/local/lib/libboost_regex.so /usr/local/lib/libboost_signals.so /usr/local/lib/libboost_system.so /usr/local/lib/libboost_filesystem.so -lz -lssl -lcrypto ../../src/Wt/Dbo/libwtdbo.so.3.2.3 /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_program_options.so /usr/local/lib/libboost_date_time.so -lpthread -ldl -Wl,-rpath,/home/s/Downloads/wt-3.2.3/build/src/http:/home/s/Downloads/wt-3.2.3/build/src:/home/s/Downloads/wt-3.2.3/build/src/Wt/Dbo:/home/s/Downloads/wt-3.2.3/build/src/Wt/Dbo/backend:/usr/local/lib
Pastie鏈接:http://pastie.org/5469815
誰能告訴這有什麼錯我的鏈接命令?
上運行cmake的, 我得到
/home/s/Downloads/wt-3.2.3/examples/gitmodel on master ✗ at 1:24PM
➜ BOOST_FS_LIB=/usr/local/lib/libboost_filesystem.so cmake .
-- ** Not building gitmodel example: requires boost_filesystem library.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 2.8)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/s/Downloads/wt-3.2.3/examples/gitmodel
正在運行cmake,我得到 – snihalani
在問題中添加了cmake輸出。 – snihalani
另外,看起來像你在/ usr/lib中安裝你的例子?你是怎麼做到的?任何鏈接將不勝感激。文檔似乎不起作用。謝謝。 – snihalani