>g++ -o hangman hangman.C -lwthttp -lwt -lboost_signals
/tmp/cc5puOIR.o: In function `createApplication(Wt::WEnvironment const&)':
hangman.C:(.text+0x19b): undefined reference to `HangmanGame::HangmanGame(Wt::WContainerWidget*)'
/tmp/cc5puOIR.o: In function `main':
hangman.C:(.text+0x3dc): undefined reference to `Session::configureAuth()'
collect2: ld returned 1 exit status
我也试过这个:
>g++ -o hangman hangman.C -I/usr/local/include -L/usr/local/lib -lwthttp -lwt -lboost_random -lboost_regex -lboost_signals -lboost_system -lboost_thread -lboost_filesystem -lboost_program_options -lboost_date_time
/usr/bin/ld: warning: libboost_program_options.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwthttp.so, may conflict with libboost_program_options.so.1.49.0
/usr/bin/ld: warning: libboost_system.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwthttp.so, may conflict with libboost_system.so.1.49.0
/usr/bin/ld: warning: libboost_thread.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwt.so, may conflict with libboost_thread.so.1.49.0
/usr/bin/ld: warning: libboost_regex.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwt.so, may conflict with libboost_regex.so.1.49.0
/usr/bin/ld: warning: libboost_signals.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwt.so, may conflict with libboost_signals.so.1.49.0
/usr/bin/ld: warning: libboost_date_time.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwt.so, may conflict with libboost_date_time.so.1.49.0
/usr/bin/ld: warning: libboost_filesystem.so.1.46.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libwt.so, may conflict with libboost_filesystem.so.1.49.0
/tmp/ccgojfHq.o: In function `createApplication(Wt::WEnvironment const&)':
hangman.C:(.text+0x19b): undefined reference to `HangmanGame::HangmanGame(Wt::WContainerWidget*)'
/tmp/ccgojfHq.o: In function `main':
hangman.C:(.text+0x3dc): undefined reference to `Session::configureAuth()'
collect2: ld returned 1 exit status
没有用。我在ubuntu 11.10
下有一个更新的提升1_49_0答案 0 :(得分:1)
hangman不是单个文件示例;链接器抱怨在不同的源(.C)文件中定义的符号。我不熟悉ubuntu安装,但我想它包含一个正确构建示例的CMakeLists.txt文件。如果这个假设是正确的,你必须使用cmake创建一个Makefile,然后运行make。
答案 1 :(得分:1)
正如user52875所写,你需要从Auth模块编译Session.cpp,或链接Session.o,也可能是Hangmangame.cpp。