Is there a way to change _ITERATOR_DEBUG_LEVEL=2 to =0 when compiling the libmongocxx on Windows (visual studio 14)

1,927 views
Skip to first unread message

William Bouchard

unread,
Jul 5, 2017, 5:58:01 PM7/5/17
to mongodb-user
Hello,

As I said in the subject I'm looking for a way to change the _ITERATOR_DEBUG_LEVEL from 2 to 0 in the static version of libmongocxx and libbsoncxx.

The reason is I'm using this lib in Unreal Engine 4 and I'm getting this kind of error:

 Error libbsoncxx.lib : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in SharedPCH.Engine.h.obj
 Error libmongocxx.lib : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in SharedPCH.Engine.h.obj

Is there a way to do that?

Sam Rossi

unread,
Jul 6, 2017, 1:31:49 PM7/6/17
to mongodb-user
Hi William! I think this is a Visual Studio setting, not a driver configuration. From looking at other instances where people have had the same problem, it looks the debug level is set to 2 for debug builds and 0 for release builds. Is it possible you compiled libmongocxx and libbsoncxxx is a different mode (debug vs. release) than your own application?

William Bouchard

unread,
Jul 10, 2017, 9:43:51 AM7/10/17
to mongodb-user
Thank you for your answer.
 It seems that even if I compile the mongocxx and bsoncxx static libs in Release mode via CMake, the debug level is set to 2, while in my project, the debug level is set to 0.

Sam Rossi

unread,
Jul 10, 2017, 1:15:44 PM7/10/17
to mongodb-user
Just to make sure, you've compiled libbson and libmongoc in release mode as well?

William Bouchard

unread,
Aug 5, 2017, 8:30:28 AM8/5/17
to mongodb-user
Hi,

Sorry for my time away, I'm back on this problem.
So, you were right, I was compiling libbson and libmongoc in Debug mode instead of Release.
That did correct the error, but I got some new ones.

I got more than 2000 error like this one : error LNK2001: unresolved external symbol __imp_mongoc_read_prefs_new

I tried with the mongo-c-driver version 1.7 and 1.6.3, but it changes nothing.
Maybe you have an idea ?

Thanks for helping :)

Sam Rossi

unread,
Aug 8, 2017, 12:19:54 PM8/8/17
to mongodb-user
Hi William,

As discussed in the thread you linked to, this is a bug that will be fixed in the mongoc 1.7.0 release, which is currently in RC. For testing purposes, you can try using the latest mongoc RC (along with the master branch of mongocxxx rather than 3.1.x), but for use in production, you'll need to dynamically link until both mongoc 1.7.0 and mongocxx 3.2.0 are released.

William Bouchard

unread,
Aug 13, 2017, 2:06:32 PM8/13/17
to mongodb-user
Okey, thank you for your help.
Reply all
Reply to author
Forward
0 new messages