• Advertisement
Sign in to follow this  

linking problem with VS2008 c++

This topic is 3031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HI I am using boost library(1.40) genrated files, that files generated while boost installation variant option are (multithread, static runtime)& VS2008. i try to call a mongodb server by simple client program ---------------------------------simple connect code ------------------ #include <iostream> #include "C:\\data\\db\\include\\mongo\\client\\dbclient.h" #pragma comment( lib, "mongoclient.lib" ) using namespace mongo; void run() { DBClientConnection c; // c.connect("local"); } int main() { try { run(); cout << "connected ok" << endl; } catch( DBException &e ) { cout << "caught " << e.what() << endl; } return 0; } -----------------------------------code end ------------------- i also provide library and include path in visual studio ->tools->option->vc directory->library & include but it display me this error list. if i remove lib path from tools->option then it demand me the list of lib files are : 1.libboost_date_time-vc90-mt-1_40.lib 2.libboost_filesystem-vc90-mt-1_40.lib 3.libboost_system-vc90-mt-1_40.lib 4.libboost_thread-vc90-mt-1_40.lib 5.libboost_program_options-vc90-mt-1_40.lib but if path is right then it display this linking error : ************************************************************************** 1>------ Build started: Project: ttu64, Configuration: Release Win32 ------ 1>Linking... 1>ttu32.obj : error LNK2001: unresolved external symbol "private: static struct mongo::BSONObj::EmptyObject mongo::BSONObj::emptyObject" (?emptyObject@BSONObj@mongo@@0UEmptyObject@12@A) 1>ttu32.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall mongo::DBClientConnection::checkResponse(char const *,int)" (?checkResponse@DBClientConnection@mongo@@MAEXPBDH@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall mongo::DBClientConnection::sayPiggyBack(class mongo::Message &)" (?sayPiggyBack@DBClientConnection@mongo@@MAEXAAVMessage@2@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall mongo::DBClientConnection::say(class mongo::Message &)" (?say@DBClientConnection@mongo@@MAEXAAVMessage@2@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall mongo::DBClientConnection::call(class mongo::Message &,class mongo::Message &,bool)" (?call@DBClientConnection@mongo@@MAE_NAAVMessage@2@0_N@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall mongo::DBClientConnection::auth(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,bool)" (?auth@DBClientConnection@mongo@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00AAV34@_N@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall mongo::DBClientConnection::connect(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?connect@DBClientConnection@mongo@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV34@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "private: void __thiscall mongo::DBClientConnection::_checkConnection(void)" (?_checkConnection@DBClientConnection@mongo@@AAEXXZ) 1>ttu32.obj : error LNK2001: unresolved external symbol "class mongo::Logstream mongo::logstream" (?logstream@mongo@@3VLogstream@1@A) 1>ttu32.obj : error LNK2001: unresolved external symbol "private: static class boost::mutex & mongo::Logstream::mutex" (?mutex@Logstream@mongo@@0AAV0boost@@A) 1>ttu32.obj : error LNK2001: unresolved external symbol "int mongo::logLevel" (?logLevel@mongo@@3HA) 1>ttu32.obj : error LNK2001: unresolved external symbol "char const * const mongo::curNs" (?curNs@mongo@@3PBDB) 1>ttu32.obj : error LNK2001: unresolved external symbol "class mongo::Nullstream mongo::nullstream" (?nullstream@mongo@@3VNullstream@1@A) 1>ttu32.obj : error LNK2001: unresolved external symbol "void __cdecl mongo::asserted(char const *,char const *,unsigned int)" (?asserted@mongo@@YAXPBD0I@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "void __cdecl mongo::dbexit(enum mongo::ExitCode,char const *)" (?dbexit@mongo@@YAXW4ExitCode@1@PBD@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall mongo::DBClientWithCommands::isMaster(bool &,class mongo::BSONObj *)" (?isMaster@DBClientWithCommands@mongo@@UAE_NAA_NPAVBSONObj@2@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall mongo::DBClientWithCommands::auth(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,bool)" (?auth@DBClientWithCommands@mongo@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00AAV34@_N@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: bool __thiscall mongo::DBClientWithCommands::runCommand(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::BSONObj const &,class mongo::BSONObj &)" (?runCommand@DBClientWithCommands@mongo@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVBSONObj@2@AAV52@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: bool __thiscall mongo::DBClientWithCommands::simpleCommand(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::BSONObj *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?simpleCommand@DBClientWithCommands@mongo@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVBSONObj@2@0@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "void __cdecl mongo::msgasserted(char const *)" (?msgasserted@mongo@@YAXPBD@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall mongo::DBClientBase::resetIndexCache(void)" (?resetIndexCache@DBClientBase@mongo@@UAEXXZ) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall mongo::DBClientBase::ensureIndex(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::BSONObj,bool,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?ensureIndex@DBClientBase@mongo@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VBSONObj@2@_N0@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall mongo::DBClientBase::update(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::Query,class mongo::BSONObj,bool)" (?update@DBClientBase@mongo@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VQuery@2@VBSONObj@2@_N@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall mongo::DBClientBase::remove(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::Query,bool)" (?remove@DBClientBase@mongo@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VQuery@2@_N@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall mongo::DBClientBase::insert(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::BSONObj)" (?insert@DBClientBase@mongo@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VBSONObj@2@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall mongo::DBClientBase::insert(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class mongo::BSONObj,class std::allocator<class mongo::BSONObj> > const &)" (?insert@DBClientBase@mongo@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$vector@VBSONObj@mongo@@V?$allocator@VBSONObj@mongo@@@std@@@4@@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual class mongo::BSONObj __thiscall mongo::DBClientBase::findOne(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::Query,class mongo::BSONObj const *,int)" (?findOne@DBClientBase@mongo@@UAE?AVBSONObj@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VQuery@2@PBV32@H@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual class std::auto_ptr<class mongo::DBClientCursor> __thiscall mongo::DBClientBase::getMore(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,__int64,int,int)" (?getMore@DBClientBase@mongo@@UAE?AV?$auto_ptr@VDBClientCursor@mongo@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@_JHH@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "public: virtual class std::auto_ptr<class mongo::DBClientCursor> __thiscall mongo::DBClientBase::query(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class mongo::Query,int,int,class mongo::BSONObj const *,int)" (?query@DBClientBase@mongo@@UAE?AV?$auto_ptr@VDBClientCursor@mongo@@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@VQuery@2@HHPBVBSONObj@2@H@Z) 1>ttu32.obj : error LNK2001: unresolved external symbol "void __cdecl mongo::uasserted(char const *)" (?uasserted@mongo@@YAXPBD@Z) 1>C:\data\db\ttu64\Release\ttu64.exe : fatal error LNK1120: 30 unresolved externals 1>Build log was saved at "file://c:\data\db\ttu64\ttu64\Release\BuildLog.htm" ************************************************************************** thanks, -CC

Share this post


Link to post
Share on other sites
Advertisement
If your application is being built in 32-bit mode, is mongoclient.lib from the 32-bit MongoDB distribution?
Or, if your application is being built in 64-bit mode, is mongoclient.lib from the 64-bit MongoDB distribution?

Share this post


Link to post
Share on other sites
yes i am compiling my application program in win32 (release) with runtime library(Multi-thread Dll).

and

while BOOST installation on system, I selected compilation option (multithread, static runtime). so even both library file generation and its use are in same environment both are multi-thread dll.

i think everything is in 32bit no doubt that i have a 64 bit system but still i not make compilation in 64 bit in VS2008 & BOOST installation option for 64 bit nothing will be compile in 64 bit system.

even mongodb server is in 32-bit that displaying("have 2GB data store limitation").

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement