简体   繁体   中英

MongoDB 2.4 C++ driver - Undefined reference to `SSL_CTX_use_certificate_chain_file'

I am trying to install the C++ MongoDB 2.4 driver using this tutorial: http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-cpp-driver/

I downloaded and built the driver source code successfully using scons.

When I'm trying to compile the sample C++ file using the recommended command:

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

I get the following error:

/usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libmongoclient.a(sock.o):
In function `mongo::SSLManager::setupPEM(std::string const&, std::string const&)':
(.text+0xc99): undefined reference to `SSL_CTX_use_certificate_chain_file'
/usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libmongoclient.a(sock.o):
In function `mongo::SSLManager::setupPEM(std::string const&, std::string const&)':
(.text+0xceb): undefined reference to `SSL_CTX_set_default_passwd_cb_userdata'

I checked and I have already installed this packages: libssl1.0.0 libssl-dev.

Please help me!

尝试使用crypto&ssl进行编译。

g++ tutorial.cpp -pthread -lmongoclient \\ -lboost_thread -lboost_filesystem -lboost_program_options -lboost_system \\ -lssl -lcrypto -o tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM