I have followed installation instructions as mentioned in the article (64-bit binaries) Installing the MongoDB C Driver (libmongoc) and BSON library (libbson) — libmongoc 1.23.4
I have got the following error:
mongoc-static-1.0.lib(mongoc-compression.obj) : error LNK2019: unresolved external symbol compress2 referenced in function mongoc_compress
I could not resolve this issue.
How to build a 32-bit library? I have followed this thread Libmongoc and libbson driver Win32 Visual Studio compilation and unfortunately its throwing the following error CMake Error: Error: generator platform: Win32 Does not match the platform used previously: Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
The driver must be built with zlib and/or snappy and/or zstd support to enable compression support.
You may also look at this article for installing C driver on Windows using Visual Studio - Getting Started with MongoDB and C++ | MongoDB
Seems like there’s a conflict with the Cmake cache. You can repeat the procedure to build in a new folder and this error should go away.
As of now I am moving forward with approach 2 as above i.e., 32-bit binaries.
I have linked the binaries and include file in my C++ project. It is throwing the following error
Can you share the code/screenshot where this error is occurring? From the error message it seems like something is being called before it is defined/declared.
Thanks, this example is working fine.
My project is referencing many third party libraries and never had this problem before. I’m seeing this error only after adding/referencing libbson or libmongoc.
Third party libraries = boost 1.83, python, hd5, zlib etc.
I suspect there maybe a conflict with the ssize_t definition by any of the other third parties/libraries that you are using. Could you cross check for ssize_t definition in the libraries that you are using?
If I include mongo headers in another source cpp file then the issue has been resolved. Very strange!
Atleast it solved my problem. Thank you for all the help.