Search code examples
ccompilationg++wt

Compiling simpleChat.C from Wt Example Error


I made changes in simpleChat.C file removing "I'm schizophrenic ..." Button. of simplechat example from wt in Ubuntu.

And tried compiling it with command:

sudo g++ -o simplechat simpleChat.C -lwthttp -lwt

Error:

/usr/bin/ld: /tmp/ccHOujNG.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv' /usr/lib/x86_64-linux-gnu/libboost_system.so.1.55.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

also adding -lboost_signals gives same error

after this error, it removes the earlier ./simplechat executable Since its overwriting it and was not able to complete..

I was able to successfully compile & execute hello.c with same command.

Any type of help reffering me on how I can succesfully compile simpleChat.C would be Great..


Solution

  • Ok.. So we have to include all other .C files and all necessary Libraries.

    Libraries we need:

    -lwthttp -lwt -lboost_system -lboost_signals -pthread
    

    all .C files

    simpleChat.C PopupChatWidget.C SimpleChatWidget.C SimpleChatServer.C
    

    Here it is all for Compiling:

    sudo g++ -o simplechat simpleChat.C PopupChatWidget.C SimpleChatWidget.C SimpleChatServer.C -lwthttp -lwt -lboost_system -lboost_signals -pthread
    

    Then you can execute it by:

    sudo ./simplechat --docroot . --http-address 0.0.0.0 --http-port 8080