【问题标题】:error compiling hangman example in wt with ubuntu 11.10使用 ubuntu 11.10 在 wt 中编译刽子手示例时出错
【发布时间】:2012-07-01 22:12:28
【问题描述】:
>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 下有一个更新的 boost 1_49_0

【问题讨论】:

    标签: wt


    【解决方案1】:

    hangman 不是单个文件示例;链接器抱怨在不同的源 (.C) 文件中定义的符号。我不熟悉 ubuntu 安装,但我猜它包含一个正确构建示例的 CMakeLists.txt 文件。如果这个假设是正确的,你必须使用 cmake 创建一个 Makefile,然后运行 ​​make。

    【讨论】:

      【解决方案2】:

      正如 user52875 所写,你需要从 Auth 模块编译 Session.cpp,或者链接 Session.o,可能还有 Hangmangame.cpp。

      【讨论】:

        猜你喜欢
        • 2012-01-23
        • 2017-04-25
        • 2012-03-07
        • 2012-01-12
        • 1970-01-01
        • 1970-01-01
        • 2014-05-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多