c++ define指令失败,代码看起来不错

标签 c++ mongodb

我正在尝试构建 mongo-cxx-driver 库

mmuratet@fisher:~/mongo-cxx-driver/build$ cmake --prefix=/usr/local ..
-- No build type selected, default is Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mmuratet/mongo-cxx-driver/build

mmuratet@fisher:~/mongo-cxx-driver/build$ make
[  3%] Built target EP_mnmlstc_core
[ 10%] Built target bsoncxx
[ 16%] Built target bsoncxx_static
[ 21%] Built target test_bson
[ 22%] Building CXX object src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o
In file included from /usr/local/include/libbson-1.0/bson-compat.h:38:0,
             from /usr/local/include/libbson-1.0/bson.h:23,
             from /home/mmuratet/mongo-cxx-driver/src/mongocxx/private/libbson.hpp:17,
             from /home/mmuratet/mongo-cxx-driver/src/mongocxx/bulk_write.cpp:18:
/usr/local/include/libbson-1.0/bson-macros.h:48:28: error: expected declaration before ‘}’ token
 #  define BSON_END_DECLS   }
                        ^
/usr/local/include/libmongoc-1.0/mongoc-stream-tls-private.h:61:1: note: in expansion of macro ‘BSON_END_DECLS’
 BSON_END_DECLS

^ make[2]: * [src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o] 错误 1 make[1]: * [src/mongocxx/CMakeFiles/mongocxx.dir/all] 错误2 make: *** [all] 错误 2

得到上面的错误。

这是有问题的代码(由 less 添加的 #s 行):

 46 #ifdef __cplusplus
 47 #  define BSON_BEGIN_DECLS extern "C" {
 48 #  define BSON_END_DECLS   }
 49 #else
 50 #  define BSON_BEGIN_DECLS
 51 #  define BSON_END_DECLS
 52 #endif

我觉得这段代码没问题。有人可以指出我错过了什么吗?包含的上游会不会有问题?如何找到它?

干杯

最佳答案

看来您正在使用 master 分支中的 libmongoc,它似乎有一个错误,即 BSON_END_DECLS 没有与上面的 BEGIN_DECLS 配对(它在之前的提交中被意外删除)

我已经在以下位置提交了错误:https://jira.mongodb.org/browse/CDRIVER-1162

1.3.4 标签是一个实际的稳定版本,似乎没有同样的问题。

关于c++ define指令失败,代码看起来不错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35348231/

相关文章:

C++:尝试为控制台创建事件驱动(但遇到问题)

node.js - 当在Mongoose中使用时,Node.js UUIDv4产生恒定的id值

javascript - Mongoose 小猫示例不起作用

javascript - 如何等到循环内的异步进程完成后再退出循环?

python - 如何在 pymongo 的 find_one_and_update() 方法中查询多个过滤器?

c++ - 将列表继承到超出范围的可排序列表保护成员

c++ - C++11 中的 C 风格回调

c++ - 如何让MSVC编译器优化多步POD初始化?

c++ - 如何在C++中创建一个n行5列的数组,但是n的值是变化的

java - Mongodb 中不区分大小写的搜索