-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Environment:Windows and RedHat 5
When we build the demo project everything works fine...but when we change the demo to use the BSONArrayBuilder, we get the following link errors (one Windows and similar link errors on Linux)
------------------------------------------------------------
Error 1 error LNK2001: unresolved external symbol "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const * const mongo::BSONObjBuilder::numStrs" (?numStrs@BSONObjBuilder@mongo@@0QBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\bsondemo.obj bsondemo Error 2 error LNK2001: unresolved external symbol "private: static bool mongo::BSONObjBuilder::numStrsReady" (?numStrsReady@BSONObjBuilder@mongo@@0_NA) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\bsondemo.obj bsondemo Error 3 error LNK1120: 2 unresolved externals C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\Debug\bsondemo.exe 1 1 bsondemo
We found the definitions for numStrs and numStrsReady in oid.cpp, but when we include that file, we then get the following link errors
------------------------------------------------------------
Error 1 error LNK2019: unresolved external symbol "void __cdecl mongo::asserted(char const *,char const *,unsigned int)" (?asserted@mongo@@YAXPEBD0I@Z) referenced in function "private: static struct mongo::OID::MachineAndPid __cdecl mongo::OID::genMachineAndPid(void)" (?genMachineAndPid@OID@mongo@@CA?AUMachineAndPid@12@XZ) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\oid.obj bsondemo Error 2 error LNK2019: unresolved external symbol "public: static unsigned __int64 __cdecl mongo::Security::getNonceDuringInit(void)" (?getNonceDuringInit@Security@mongo@@SA_KXZ) referenced in function "private: static struct mongo::OID::MachineAndPid __cdecl mongo::OID::genMachineAndPid(void)" (?genMachineAndPid@OID@mongo@@CA?AUMachineAndPid@12@XZ) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\oid.obj bsondemo Error 3 error LNK2019: unresolved external symbol "public: static unsigned __int64 __cdecl mongo::Security::getNonce(void)" (?getNonce@Security@mongo@@SA_KXZ) referenced in function "public: void __cdecl mongo::OID::init(void)" (?init@OID@mongo@@QEAAXXZ) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\oid.obj bsondemo Error 4 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\oid.obj bsondemo Error 5 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ) C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\oid.obj bsondemo Error 6 error LNK1120: 5 unresolved externals C:\Build\Dev3\firescope-agent\thirdparty\mongodb-src\bson\bsondemo\Debug\bsondemo.exe 1 1 bsondemo
If we include the jsobj.h file instead of bson.h on Linux, then we get a whole new set of boost link errors. Can you get us a working demo project or directions which will build a BSONArrayBuilder object like the following
------------------------------------------------------------
mongo::BSONObjBuilder topLevel; { topLevel.append("\"ip\"","10.0.22.163"); topLevel.append("\"~collection\"", "cloud_monitoring"); topLevel.append("\"fsedition\"", "SMONGO"); mongo::BSONArrayBuilder items (topLevel.subarrayStart("cloud_attribute_results")); { mongo::BSONObjBuilder item (items.subobjStart()); item.append("dly", 6); item.append("er", "error string in the event of an error collecting the attribute"); item.append("ere", 5); item.append("lc", 4); item.append("lv", "string representation of the collected value"); item.append("pt", 3); item.append("op", "operation"); item.append("adesc", "attribute description"); item.append("atyp", 2); item.append("vtyp", 1); item.done(); mongo::BSONObjBuilder item2 (items.subobjStart()); item2.append("dly", 10); item2.append("er", "error string in the event of an error collecting the attribute"); item2.append("ere", 20); item2.append("lc", 30); item2.append("lv", "string representation of the collected value"); item2.append("pt", 40); item2.append("op", "operation"); item2.append("adesc", "attribute description"); item2.append("atyp", 50); item2.append("vtyp", 60); item2.done(); mongo::BSONObjBuilder item20 (items.subobjStart()); item20.append("dly", 100); item20.append("er", "error string in the event of an error collecting the attribute"); item20.append("ere", 200); item20.append("lc", 300); item20.append("lv", "string representation of the collected value"); item20.append("pt", 400); item20.append("op", "operation"); item20.append("adesc", "attribute description"); item20.append("atyp", 500); item20.append("vtyp", 600); item20.done(); } items.done(); } mongo::BSONObj finished (topLevel.obj());