C++ 无法针对mongo C++;戴软呢帽的司机
我无法编译使用mongodb cxx驱动程序的代码。使用C驱动程序一切正常,但不使用Cxx。我运行Fedora 28,并已从Fedors的官方存储库安装了以下软件包: mongo-c-driver-1.9.5-1.fc28.x86_64 mongo-c-driver-devel-1.9.5-1.fc28.x86_64 mongo-c-driver-libs-1.9.5-1.fc28.x86_64 mongo-cxx-driver-1.1.2-13.fc28.x86_64 mongo-cxx-driver-devel-1.1.2-13.fc28.x86_64 我试图编译的代码没有调用任何API函数来连接到数据库,但作为第一步,使用连接到mongodb并运行操作所需的包含文件和名称空间。我尝试编译的代码是:C++ 无法针对mongo C++;戴软呢帽的司机,c++,mongodb,mongo-cxx-driver,C++,Mongodb,Mongo Cxx Driver,我无法编译使用mongodb cxx驱动程序的代码。使用C驱动程序一切正常,但不使用Cxx。我运行Fedora 28,并已从Fedors的官方存储库安装了以下软件包: mongo-c-driver-1.9.5-1.fc28.x86_64 mongo-c-driver-devel-1.9.5-1.fc28.x86_64 mongo-c-driver-libs-1.9.5-1.fc28.x86_64 mongo-cxx-driver-1.1.2-13.fc28.x86_64 mongo-cxx-dr
#include <cstdint>
#include <iostream>
#include <vector>
#include <mongo/db/json.h>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;
int main() {
return 0;
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
使用bsoncxx::builder::stream::close_数组;
使用bsoncxx::builder::stream::close\u文档;
使用bsoncxx::builder::stream::document;
使用bsoncxx::builder::stream::finalize;
使用bsoncxx::builder::stream::open_数组;
使用bsoncxx::builder::stream::open_文档;
int main(){
返回0;
}
我尝试编译代码如下:
$C++——STD= C++ 11蒙古文CXX.cc-O测试$(PKG CONFIG-CFLAGS) libmongocxx)
在pkg配置搜索路径中未找到包libmongocxx。 也许您应该将包含“libmongocxx.pc”的目录添加到 PKG_CONFIG_PATH环境变量包'libmongocxx', “virtual:world”所需,在中包含的文件中找不到 /usr/include/mongo/db/json.h:20, 来自mongo cxx.cc:4:/usr/include/mongo/bson/bsonobj.h:20:10:致命错误: boost/noncopyable.hpp:没有这样的文件或目录#包含 ^~~~~~~~~~~~~~~~~~~~~~~ 如前所述,我使用Fedora的PackageManager安装monogdb的cxx驱动程序,而不是从源代码编译。我还有什么需要做的吗 谢谢你的帮助 D.< /P> < P>你试图混合旧的C++驱动程序和新的C++驱动程序。您安装的包,
- 如果你不能得到新的C++驱动程序,你需要使用遗留的驱动程序,你应该停止使用<代码> BSONCX和<代码> MunGoCX标头。您将需要安装Boost开发头和库,并且停止尝试调用PKG CONFIG,这只是在找到新的C++驱动程序时使用的。