编译时未定义对 bsoncxx 的引用 mongodb-cxx-driver

Undefined reference to bsoncxx when compiling mongodb-cxx-driver

os: Windows 10
编译器:MinGW w64 8.1.0 i686
mongo-c-驱动程序:1.16.2
mongo-cxx-driver:分支 releases/v3.5

的提交 4629521

编译选项:

BSONCXX_POLY_USE_STD=ON
CMAKE_CXX_STANDARD=17

我在尝试编译 mongo-cxx-driver 时收到以下错误:

[ 13%] Linking CXX executable test_bson.exe
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0xf17): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types10b_document7type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x10ae): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types7b_int327type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x1563): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types7b_array7type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x16f2): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types7b_int327type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x1b5d): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types7b_int327type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x1e42): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types6b_bool7type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x2292): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types7b_int327type_idE'
CMakeFiles\test_bson.dir/objects.a(bson_builder.cpp.obj):bson_builder.cpp:(.text+0x2579): undefined reference to `_imp___ZN7bsoncxx7v_noabi5types6b_bool7type_idE'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\bsoncxx\test\CMakeFiles\test_bson.dir\build.make:236: src/bsoncxx/test/test_bson.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:987: src/bsoncxx/test/CMakeFiles/test_bson.dir/all] Error 2
mingw32-make: *** [Makefile:160: all] Error 2

答案是不支持MinGW的mongodb-cxx驱动:https://developer.mongodb.com/community/forums/t/undefined-reference-to-bsoncxx-when-try-to-compile/2896/4?u=alexxanderx