You are not logged in.

#1 2013-10-17 14:56:58

Aquila
Member
Registered: 2012-12-23
Posts: 46

[SOLVED] Problem compiling with MongoDB C++ driver

Hey there,

I am attempting to compile a simple code that connects to a  MongoDB server in C++.

Here are the simple instructions to install the C++ Driver
http://docs.mongodb.org/ecosystem/tutor … cpp-driver

Just download and run scons to build. They recommend boost 1.49 and I have boost 1.54, but I suspect the document is a little outdated.

I have a sample program that I am trying to compile with this statement.

g++ mclient.cpp -pthread -lmongoclient -lboost_filesystem -lboost_program_options -lboost_system -lboost_thread-mt -o tutorial

But I get the error
/usr/bin/ld: cannot find -lboost_thread-mt
collect2: error: ld returned 1 exit status

It compiles if I take out -lboost_thread-mt

Can anyone help me solve this error?

Thanks!

Last edited by Aquila (2013-10-17 17:09:08)

Offline

#2 2013-10-17 15:33:20

jean_no
Member
Registered: 2007-09-18
Posts: 48

Re: [SOLVED] Problem compiling with MongoDB C++ driver

Hi

you can test with -llibboost_filesystem -llibboost_program_options -llibboost_system -llibboost_thread

Offline

#3 2013-10-17 16:42:59

Aquila
Member
Registered: 2012-12-23
Posts: 46

Re: [SOLVED] Problem compiling with MongoDB C++ driver

Hi there,

I tried
g++ mclient.cpp -llibboost_filesystem -llibboost_program_options -llibboost_system -llibboost_thread -o tutorial

and received

/usr/bin/ld: cannot find -llibboost_filesystem
/usr/bin/ld: cannot find -llibboost_program_options
/usr/bin/ld: cannot find -llibboost_system
/usr/bin/ld: cannot find -llibboost_thread
collect2: error: ld returned 1 exit status

Offline

#4 2013-10-17 16:49:51

SOURE
Member
Registered: 2013-10-15
Posts: 6

Re: [SOLVED] Problem compiling with MongoDB C++ driver

$ ls /usr/include/boost | grep thread
thread
thread.hpp

Try without the leading -mt?

Offline

#5 2013-10-17 17:08:44

Aquila
Member
Registered: 2012-12-23
Posts: 46

Re: [SOLVED] Problem compiling with MongoDB C++ driver

Thanks! I took off the -mt from -lboost-_thread-mt and it compiles

Offline

Board footer

Powered by FluxBB