我已经从http://mongoc.org/libmongoc/current/installing.html网站完成了安装,我已经安装了所有网站,并且安装成功,但是当我运行以下程序时
这给了我以下错误
tutorial.cpp:3:35: fatal error: mongo/client/dbclient.h: No such file or directory
compilation terminated. enter code here
我提到了Mongo C++ Driver: mongo/client/dbclient.h: No such file or directory 但这并不能解决我的问题
#include <cstdlib>
#include <iostream>
#include "mongo/client/dbclient.h"
void run() {
mongo::DBClientConnection c;
c.connect("localhost");
}
int main() {
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const mongo::DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
我build
目录
但没有libmongoclient.a
文件要复制到
/opt/local/lib
我试过了
g++ -I/opt/local/include -L/opt/local/lib -pthread -lmongoclient -lboost_thread-mt -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt tutorial.cpp -o tutorial
也命令
但输出与上面的命令相同
我检查了/usr/local/include
,有libbson-1.0
libmongoc-1.0
档案
我没有/opt/local/include/mongo/client/dbclient.h
文件
而且我也找不到libmongoclient.a
。
我没有得到什么问题