addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

New York MongoDB User Group Message Board › There's probably a better forum for linker error questions, but...

There's probably a better forum for linker error questions, but...

A former member
Post #: 1
Can anyone help me link against the mongoclient lib for the C++ drivers? I got these errors when I tried to use the prebuilt binaries, so I built mongo from source, then mongo_common and mongoclient, using VC Express. I checked that I was building my client application using the same flags that I built mongoclient.lib with. I had some funny issues with default libraries while building mongo itself, so I wonder if that might be affecting this current error list. I'm posting this question here because, frankly, this is the browser window I have right now and I'm too tired to try to remember the url for other mongodb groups. Hope someone can help me anyhow. Thanks!

mongoclient.lib(dbclient.obj) : error LNK2019: unresolved external symbol __imp__getnameinfo@28 referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall mongo::SockAddr::getAddr(void)const " (?getAddr@SockAddr@mongo@@QBE?AV?$basic_­string@DU?$char_traits@D@std@@V?$allocat­or@D@2@@std@@XZ)
1>mongoclient.lib(message.obj) : error LNK2001: unresolved external symbol __imp__getnameinfo@28
1>mongoclient.lib(sock.obj) : error LNK2001: unresolved external symbol __imp__getnameinfo@28
1>mongoclient.lib(jsobj.obj) : error LNK2019: unresolved external symbol "void __cdecl mongo::base64::encode(class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,char const *,int)" (?encode@base64@mongo@@YAXAAV?$basic_str­ingstream@DU?$char_traits@D@std@@V?$allo­cator@D@2@@std@@PBDH@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall mongo::BSONElement::jsonString(enum mongo::JsonStringFormat,bool,int)const " (?jsonString@BSONElement@mongo@@QBE?AV?$­basic_string@DU?$char_traits@D@std@@V?$a­llocator@D@2@@std@@W4JsonStringFormat@2@­_NH@Z)
1>mongoclient.lib(json.obj) : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl mongo::base64::decode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?decode@base64@mongo@@YA?AV?$basic_stri­ng@DU?$char_traits@D@std@@V?$allocator@D­@2@@std@@ABV34@@Z) referenced in function "public: void __thiscall mongo::binDataBinary::operator()(char const *,char const *)const " (??RbinDataBinary@mongo@@QBEXPBD0@Z)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol ___WSAFDIsSet@8 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__select@20 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(sock.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(sock.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: void __thiscall mongo::Listener::initAndListen(void)"­ (?initAndListen@Listener@mongo@@QAEXXZ)
1>mongoclient.lib(sock.obj) : error LNK2001: unresolved external symbol __imp__socket@12
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function "public: unsigned int __thiscall mongo::SockAddr::getPort(void)const " (?getPort@SockAddr@mongo@@QBEIXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: virtual void __thiscall mongo::ConnectBG::run(void)" (?run@ConnectBG@mongo@@UAEXXZ)
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: void __thiscall mongo::MessagingPort::send(char const *,int,char const *)" (?send@MessagingPort@mongo@@QAEXPBDH0@Z)­
1>mongoclient.lib(message.obj) : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: void __thiscall mongo::MessagingPort::recv(char *,int)" (?recv@MessagingPort@mongo@@QAEXPADH@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function "public: __thiscall mongo::SockAddr::SockAddr(int)" (??0SockAddr@mongo@@QAE@H@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: __thiscall mongo::SockAddr::SockAddr(int)" (??0SockAddr@mongo@@QAE@H@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__freeaddrinfo@4 referenced in function "public: __thiscall mongo::SockAddr::SockAddr(char const *,int)" (??0SockAddr@mongo@@QAE@PBDH@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function "public: __thiscall mongo::SockAddr::SockAddr(char const *,int)" (??0SockAddr@mongo@@QAE@PBDH@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__sendto@24 referenced in function "public: int __thiscall mongo::UDPConnection::sendto(char *,int,struct mongo::SockAddr const &)" (?sendto@UDPConnection@mongo@@QAEHPADHAB­USockAddr@2@@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__getsockopt@20 referenced in function "public: bool __thiscall mongo::UDPConnection::init(struct mongo::SockAddr const &)" (?init@UDPConnection@mongo@@QAE_NABUSock­Addr@2@@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__recvfrom@24 referenced in function "public: int __thiscall mongo::UDPConnection::recvfrom(char *,int,struct mongo::SockAddr &)" (?recvfrom@UDPConnection@mongo@@QAEHPADH­AAUSockAddr@2@@Z)
1>mongoclient.lib(sock.obj) : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: __thiscall mongo::`anonymous namespace'::WinsockInit::WinsockInit(voi­d)" (??0WinsockInit@?A0xea93b6db@mongo@@QAE@­XZ)
1>mongoclient.lib(connpool.obj) : error LNK2019: unresolved external symbol "public: __thiscall mongo::SyncClusterConnection::SyncCluste­rConnection(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0SyncClusterConnection@mongo@@QAE@V?$­basic_string@DU?$char...
A former member
Post #: 2
I've solved the problem, but only by some rough hacking around the sources, so I don't mind if someone has a more elegant answer to what was wrong. Most of the errors were resolved by forcing an include of ws2_32.lib, for sockets. That left three others, and I just followed the methods around until I found files that weren't being included in the projects but whose object files were needed, and manually added them to the project. I assume I'm having trouble by not using scons, which I tried but couldn't get to work either, and I'm not ready to learn yet another build tool. So far, so good. It's weird how after two hours or so you solve a problem about 10 minutes after your bite the bullet and post a question to some user group...hardly the first time I've done that.
Powered by mvnForum

Our Sponsors

  • MongoDB

    MongoDB organizes the NY MongoDB User Group

  • O'Reilly

    Members save 40% off print and 50% off ebooks use discount code DSUG

  • Pearson

    Providing technical book and discounts! 35% off: USERGROUP

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy