如何配置Eclipse CDT以在Linux中编译包含mongocxx驱动程序的代码?

时间:2017-11-07 10:21:57

标签: eclipse mongodb eclipse-cdt

我试图配置eclipse cdt来编译包含mongocxx驱动程序的代码。此代码来自mongo的安装页面。我在自己的项目中遇到的错误在这里清楚地显示出来。包含已被识别,但我认为它是链接器问题。

#include <iostream>

#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>

#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>

int main(int, char**) {
    mongocxx::instance inst{}; 
    mongocxx::client conn{mongocxx::uri{}};

    bsoncxx::builder::stream::document document{};

    auto collection = conn["testdb"]["testcollection"];
    document << "hello" << "world";

    collection.insert_one(document.view());
    auto cursor = collection.find({});

    for (auto&& doc : cursor) {
        std::cout << bsoncxx::to_json(doc) << std::endl;
    }
}

This is my actual screenshot with errors from my IDE

0 个答案:

没有答案