Dears,
Using the latest version of libmongoc, 1.29.1, my Visual Studio 2022 Project compiles just fine with MT and even MD setting, but only with the dynamic libs bson-1.0.lib and mongoc-1.0.lib.
This causes my resulting output (mydll.dll) to still require the bson-1.0.dll and mongoc-1.0.dll to be externally available. But i would like them statically compiled into mydll.dll so i have no hassles with local deployments.
I followed the guide here: Using libmongoc in a Microsoft Visual Studio project — libmongoc 1.23.1
The procedure is to include bson-static-1.0.lib and mongoc-static-1.0.lib (and a few other libs), as well as before include mongoc.h, write these lines
#define BSON_STATIC
#define MONGOC_STATIC
When i do that in my application, i get these > 400 warnings and 47 errors like this:
1>mongoc-static-1.0.lib(kms_request_str.obj) : error LNK2019: unresolved external symbol __imp_strdup referenced in function kms_request_str_path_normalized
1>OLDNAMES.lib(strdup.obi) : error LNK2001: unresolved external symbol __imp_strdup
1>OLDNAMES.lib(strdup.obi) : error LNK2001: unresolved external symbol __imp__strdup
1>C:\dev\MongoCBridge\x64\Debug\MongoCBridge.dll : fatal error LNK1120: 17 unresolved externals
When i try the same procedure with the hello_mongoc project from the examples of libmongoc, i also get errors but a little different. Examples:
2>hello_mongoc.obj : error LNK2019: unresolved external symbol __imp_bson_free referenced in function main
2>hello_mongoc.obj : error LNK2019: unresolved external symbol __imp_bcon_new referenced in function main
Any clues?