I'm trying to run the example program for the MongoDB C++ Driver so I can run some tests, and have come across some errors that I'm stuck on.
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mongo::DBClientConnection::DBClientConnection(bool,class mongo::DBClientReplicaSet *,double)" (__imp_??0DBClientConnection@mongo@@QAE@_NPAVDBClientReplicaSet@1@N@Z) referenced in function "void __cdecl run(void)" (?run@@YAXXZ) E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj BoostTest
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall mongo::DBClientConnection::~DBClientConnection(void)" (__imp_??1DBClientConnection@mongo@@UAE@XZ) referenced in function "void __cdecl run(void)" (?run@@YAXXZ) E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj BoostTest
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall mongo::DBClientConnection::connect(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?connect@DBClientConnection@mongo@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl run(void)" (?run@@YAXXZ) E:\Programming\C++\BoostTest\BoostTest\BoostTest\Testcpp.obj BoostTest
Here's the code
#include <cstdlib>
#include <iostream>
#include "mongo\client\dbclient.h"
#define BOOST_ALL_DYN_LINK
void run()
{
mongo::DBClientConnection c;
c.connect("localhost");
}
int main()
{
try
{
run();
std::cout << "Connected" << std::endl;
}
catch(const mongo::DBException &e)
{
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
Before anyone asks, I have the Boost Libraries and Headers referenced and they seem to work fine. I have also referenced the Mongo libraries and Headers.
Additional Include Directories: Boost and Mongo Source
Linker Additional Library Directories: boost/stage/lib and Mongo build client
Anyone have any clues? Do I have to include the dbclient.obj file in Additional Dependencies? When I do I get like 96 new errors. I think I might be missing some .dll but can't figure out what.
Would appreciate any help as this is only a small part of a much larger project.