Missing Lboost_Thread-Mt in Mongodb Cpp Driver (Ubuntu Server X64)

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

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

/usr/bin/ld: cannot find -lboost_thread-lpthread

I think you need a space between -lboost_thread and -lpthread in your command line.

How to compile C++ mongo project

You need to use -I and -L to specify where you have installed your mongo header(s) and library(ies):

g++ tutorial.cpp -I/path/to/mongo/include/ -pthread -L/path/to/libmongoclient 
-lboost_thread-mt -lboost_filesystem -lboost_program_options
-lboost_system -o tutorial

compile with boost on ubuntu 14.04 : undefined reference to `boost::thread::get_id() const'


/home/khan/git/sdkLinux/libFingiSdk/Debug/libfingidevicesdk.so: undefined reference to `boost::thread::get_id() const'

You need to link libfingidevicesdk.so with the boost thread library as well.

Linkage error with Boost Log 1.65.0 example from the Boost.org

I'm answering my own question, following the @Praetorian help and suggestion.

The Boost Log relies on two libraries (I thought it was only one):

hekto@ubuntu:~$ ls -l /usr/lib/x86_64-linux-gnu/libboost_log*
-rw-r--r-- 1 root root 3510082 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log.a
-rw-r--r-- 1 root root 2441460 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log_setup.a
lrwxrwxrwx 1 root root 28 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log_setup.so -> libboost_log_setup.so.1.65.1
-rw-r--r-- 1 root root 671944 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log_setup.so.1.65.1
lrwxrwxrwx 1 root root 22 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log.so -> libboost_log.so.1.65.1
-rw-r--r-- 1 root root 905752 Mar 6 2018 /usr/lib/x86_64-linux-gnu/libboost_log.so.1.65.1

If you compile and link on Linux, you'll have to provide a list of Boost libraries on the command line. According to an answer to this question, given by the main developer (@AndreySemashev) of the Boost Log, these libraries on the command line should look like this:

-lboost_log_setup -lboost_log

Probably it makes sense to provide two libraries instead of one (for example, when you link statically), but I couldn't find any recommendations about when we should use a single library, and when - both of them.



Related Topics



Leave a reply



Submit