2016-02-11 20 views
1

我试图建立mongocxx驱动程序库C++定义指令失败,代码看起来OK

[email protected]:~/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 

[email protected]:~/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 

^ 化妆[2]:* [来源/ mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o]错误1个 化妆[1]:* [来源/ mongocxx/CMakeFiles/mongocxx.dir /全部]错误2 化妆:*** [全部]错误2

并且得到错误以上。

这里是有问题的代码(一行少添加#秒):

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 

该代码看起来不错给我。有人能指出我错过了什么吗?在包含中上游会有问题吗?如何找到它?

干杯

+0

我认为你只能定义常量或函数宏,而不是块的一部分。 –

+1

你可以显示代码在哪里抱怨宏扩展? – NathanOliver

+0

什么版本的C++ 11驱动程序?什么版本的C驱动程序?什么编译器?什么平台? – acm

回答

1

看来,您正在使用libmongoc从主分支,它似乎有哪里是BSON_END_DECLS不以高于BEGIN_DECLS配对错误(它是由事故在以前退学承诺)

我在建档的错误:https://jira.mongodb.org/browse/CDRIVER-1162

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