I'm having one crazy hard time compiling the Mongo C++ driver for Windows.
The word "crazy" is key here as I am almost ready to go insane (one of my only posts to a coding forum in my lifetime).
I first tried here: http://docs.mongodb.org/ecosystem/drivers/cpp/
And could usually get 99.99999% of the way there I would encounter some cryptic linking error.
But like reaching the speed of light I couldn't reach the 100% mark to write a single line of functional Mongo C++ code on Windows.
See this comment posted on Nov 4, 2013:
http://stackoverflow.com/questions/1977 ... of-mongodb
"What is the error? The C++ driver compilation process on Windows is NOTORIOUSLY horrible"
After some time I gave up on this approach and worked on building the Poco libraries, the latest of which includes a MongoDB module (I now have other reasons for wanting to use Poco besides just Mongo but the Mongo component is critical in my application).
I had read a comment about another user having similar problems as myself, who initially gave up, and was able to build the Poco/Mongo C++ driver on Windows.
Here, I COULD build the 32 bit version and run any of the C++ samples demonstrating the use of MongoDB via the awesome Poco toolset.
However, I need more than 32 bits worth of RAM to make my application feasible.
When I try to build the 64 bit version (static or shared, using VS 2010 Pro or not) of Poco/Mongo, I can (apparently) build all dependent libraries without issue. When I compile the 64 bit Mongo demos in Poco, my hopes are additionally high. Then when I run a sample such as "bin64/SQLToMongo.exe" or "bin64/TestSuite.exe" under the MongoDB module, my hopes advance even further (especially since the 32 bit version worked just fine). When I can confirm through RoboMongo that the connections are made using these compiled apps I am ready to think my Twilight Zone episode has finished, and I can finally write a single line of C++ code that can talk to Mongo on Windows in 64 bit mode.
NOT SO however.
When I run these sample Poco/Mongo codes (64 bit on Windows), just the demos themselves, they can connect but cannot perform any operation successfully within Mongo (as verified by RoboMongo). Yet if I flip to 32 bit mode and compile, presto, the same code works.
For example, in "SQLToMongo.cpp", sample1 executes until reaching this line of code:
std::string lastError = db.getLastError(connection);
And at this point the application hangs, with no results whatsoever showing up.
If I put another line of code in front of this:
int count = (int)db.count( connection, "team");
Also the application hangs (with any call to db.whatever) in 64 bit mode.
As another example, in "MongoDBTest::testInsertRequest()", code that I have not modified whatsoever from the demo, seems to have no issues and completes in 64 bit mode. I can see in the Mongo log file the connect and disconnect events. But no results show up in the MongoDB after this test insert (as verified by RoboMongo). Once again, perfect execution in 32 bit mode, but that doesn't help me given my requirements.
I seriously have no idea whatsoever to even look for at this point, so any advice for what I should do next would be greatly appreciated, other than give up, use 32 bit mode, or try another database or operating system, etc. At this point I am grasping at straws like do I need to use a super extra special flavor of "mongod.exe" etc. I have Visual Studio 2010 Pro and Windows 7 Pro.
Sample code and the build attempts are attempted directly from the Poco/Mongo library from "poco-poco-1.5.2-release.zip".
Thanks in advance for any insights.