missing lboost_thread-mt in mongodb cpp driver (ubuntu server x64)

只愿长相守 提交于 2019-12-20 04:30:29

问题


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!!


回答1:


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



来源:https://stackoverflow.com/questions/20889614/missing-lboost-thread-mt-in-mongodb-cpp-driver-ubuntu-server-x64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!