i have a brand new ubuntu server x64.
i installed the following packages
build-essential
libboost-all-dev
mongodb-dev
mongodb-10gen
now when i try to compile the example code i get this error.
root@server:/home/user/Desktop# g++ mongotest.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system -o tutorial
/usr/bin/ld: cannot find -lboost_thread-mt
collect2: error: ld returned 1 exit status
i searched everywhere i can think of and in every way i can think of but it doesn’t work.
UPDATE: like vershov said it works with the lboost_thread but it needs lssl and lcrypto to compile
the final command that worked for me is:
g++ mongoc.cpp -pthread -lmongoclient -lboost_thread -lboost_filesystem -lboost_program_options -lboost_system -lssl -lcrypto -o tutorial
thank you vershov!!
Advertisement
Answer
Page http://packages.ubuntu.com/saucy/i386/libboost-thread1.54-dev/filelist shows that Ubuntu libboost-thread package has libboost_thread.so library file, not libboost_thread-mt.so
So, correct command is:
root@server:/home/user/Desktop# g++ mongotest.cpp -pthread -lmongoclient -lboost_thread -lboost_filesystem -lboost_program_options -lboost_system -o tutorial