以下是供参考的代码 http://pastebin.com/nr7wuxNA
我正在用mongo的C ++驱动程序测试一些调用
除非我添加此行
,否则它有效obj.appendBinData( "binTest",sizeof(test), BinDataGeneral, test);
以下是错误消息
ninexample.cpp: In function ‘int main(int, const char**)’:
ninexample.cpp:73:48: error: ‘BinDataGeneral’ was not declared in this scope
obj.appendBinData( "binTest",sizeof(test), BinDataGeneral, test);
^
ninexample.cpp:73:48: note: suggested alternative:
In file included from /usr/include/mongo/db/jsobj.h:34:0,
from /usr/include/mongo/client/dbclientinterface.h:25,
from /usr/include/mongo/client/connpool.h:23,
from /usr/include/mongo/client/dbclient.h:32,
from ninexample.cpp:22:
/usr/include/mongo/bson/bsontypes.h:102:9: note: ‘BinDataGeneral’
BinDataGeneral=0,
^
我对C ++很陌生,所以我不确定为什么会出现错误,因为它似乎在h文件中看到了BinDataGeneral类型。
有人可以为我澄清这个吗?
谢谢!
答案 0 :(得分:1)
编译器正在寻找BinDataGeneral
,但它无法解析该符号。
尝试mongo::BinDataGeneral
。