I’m getting a fatal error and warnings during compile. Data security is going to be of v. high importance so even if I just ignored it and a linked-in app worked I’m not sure whether it would be safe?
I’m compiling the c++ drivers under Win10 with VS2022 (having just built and installed the c drivers)
However getting a fatal error from bson_builder.cpp (as per output below)
and a warning for many other files
“C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc”
as below
I did try and add EHsc to the flags in CMakeLists.txt, but it seem to be ignored
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g --coverage /EHsc")
These are the commands entered via VS Command Prompt:
>> cmake .. -G "Visual Studio 17 2022" -A x64 -DBUILD_VERSION=3.6.0 -DBOOST_ROOT=C:\Users\dgm55\source\repos\boost_1_81_0 -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="/Zc:__cplusplus" -DCMAKE_PREFIX_PATH=C:\Users\dgm55\source\repos\mongo-c-driver -DCMAKE_INSTALL_PREFIX=C:\Users\dgm55\source\repos\mongo-cxx-driver
>> cmake --build .
This is the one of the warnings and the fatal
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(305,1): warning C4530
: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\dgm55\source\repos\mongo-cx
x-driver\build\src\bsoncxx\test\test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(298,1): message : whi
le compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,s
td::char_traits<char>>::operator <<(unsigned int)' [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test
\test_bson.vcxproj]
C:\Users\dgm55\source\repos\mongo-cxx-driver\src\bsoncxx/test_util/to_string.hh(53,57): message : see reference to func
tion template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<
char>>::operator <<(unsigned int)' being compiled [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\
test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671,75): message : se
e reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled [C:\Users\
dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
Generating Code...
C:\Users\dgm55\source\repos\mongo-cxx-driver\src\bsoncxx\test\bson_builder.cpp(1705): fatal error C1001: Internal comp
iler error. [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
(compiler file 'D:\a\_work\1\s\src\vctools\Compiler\Utc\src\p2\main.c', line 224)
To work around this problem, try simplifying or changing the program near the locations listed above.
The full output is below
C:\Users\dgm55\source\repos\mongo-cxx-driver\build>cmake .. -G "Visual Studio 17 2022" -A x64 -DBUILD_VERSION=3.6.0 -DBOOST_ROOT=C:\Users\dgm55\source\repos\boost_1_81_0 -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="/Zc:__cplusplus" -DCMAKE_PREFIX_PATH=C:\Users\dgm55\source\repos\mongo-c-driver -DCMAKE_INSTALL_PREFIX=C:\Users\dgm55\source\repos\mongo-cxx-driver
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19043.
-- No build type selected, default is Release
-- Auto-configuring bsoncxx to use C++17 std library polyfills since C++17 is active and user didn't specify otherwise
bsoncxx version: 3.6.0
found libbson version 3.6.0
mongocxx version: 3.6.0
found libmongoc version 3.6.0
-- Build files generated for:
-- build system: Visual Studio 17 2022
-- instance: C:/Program Files/Microsoft Visual Studio/2022/Community
-- instance: x64
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/dgm55/source/repos/mongo-cxx-driver/build
C:\Users\dgm55\source\repos\mongo-cxx-driver\build>cmake --build .
MSBuild version 17.4.1+9a89d02ff for .NET Framework
bsoncxx_shared.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\Debug\bsoncxx.dll
bsoncxx_testing.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\Debug\bsoncxx-testing.dll
mongocxx_mocked.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\Debug\mongocxx-mocked.dll
mongocxx_shared.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\Debug\mongocxx.dll
array.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(305,1): warning C4530
: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\dgm55\source\repos\mongo-cx
x-driver\build\src\bsoncxx\test\test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(298,1): message : whi
le compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,s
td::char_traits<char>>::operator <<(unsigned int)' [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test
\test_bson.vcxproj]
C:\Users\dgm55\source\repos\mongo-cxx-driver\src\bsoncxx/test_util/to_string.hh(53,57): message : see reference to func
tion template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<
char>>::operator <<(unsigned int)' being compiled [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\
test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671,75): message : se
e reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled [C:\Users\
dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
bson_b_date.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(305,1): warning C4530
: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\dgm55\source\repos\mongo-cx
x-driver\build\src\bsoncxx\test\test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(298,1): message : whi
le compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,s
td::char_traits<char>>::operator <<(unsigned int)' [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test
\test_bson.vcxproj]
C:\Users\dgm55\source\repos\mongo-cxx-driver\src\bsoncxx/test_util/to_string.hh(53,57): message : see reference to func
tion template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<
char>>::operator <<(unsigned int)' being compiled [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\
test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671,75): message : se
e reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled [C:\Users\
dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
main.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(544,1): warning C4530
: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\dgm55\source\repos\mongo-cx
x-driver\build\src\bsoncxx\test\test_bson.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(536,1): message : whi
le compiling class template member function 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,s
td::char_traits<char>>::write(const _Elem *,std::streamsize)' [C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\b
soncxx\test\test_bson.vcxproj]
with
[
_Elem=char
]
C:\Users\dgm55\source\repos\mongo-cxx-driver\src\third_party\catch\include\catch.hpp(13929,9): message : see reference
to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_
traits<char>>::write(const _Elem *,std::streamsize)' being compiled [C:\Users\dgm55\source\repos\mongo-cxx-driver\build
\src\bsoncxx\test\test_bson.vcxproj]
with
[
_Elem=char
]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671,75): message : se
e reference to class template instantiation 'std::basic_ostream<char,std::char_traits<char>>' being compiled [C:\Users\
dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
Generating Code...
test_bson.dir\Debug\bson_builder.obj : fatal error LNK1136: invalid or corrupt file [C:\Users\dgm55\source\repos\mongo-
cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
test_client_side_encryption_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Deb
ug\test_client_side_encryption_specs.exe
test_command_monitoring_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\t
est_command_monitoring_specs.exe
test_crud_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_crud_specs
.exe
test_driver.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_driver.exe
test_gridfs_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_gridfs_s
pecs.exe
test_instance.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_instance.exe
test_logging.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_logging.exe
test_mongohouse_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_mong
ohouse_specs.exe
test_read_write_concern_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\t
est_read_write_concern_specs.exe
test_retryable_reads_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test
_retryable_reads_specs.exe
test_transactions_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_tr
ansactions_specs.exe
test_unified_format_spec.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_u
nified_format_spec.exe
test_versioned_api.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_version
ed_api.exe
C:\Users\dgm55\source\repos\mongo-cxx-driver\build>cmake --build . --target install
MSBuild version 17.4.1+9a89d02ff for .NET Framework
bsoncxx_shared.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\Debug\bsoncxx.dll
bsoncxx_testing.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\bsoncxx\Debug\bsoncxx-testing.dll
mongocxx_mocked.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\Debug\mongocxx-mocked.dll
mongocxx_shared.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\Debug\mongocxx.dll
test_bson.dir\Debug\bson_builder.obj : fatal error LNK1136: invalid or corrupt file [C:\Users\dgm55\source\repos\mongo-
cxx-driver\build\src\bsoncxx\test\test_bson.vcxproj]
test_client_side_encryption_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Deb
ug\test_client_side_encryption_specs.exe
test_command_monitoring_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\t
est_command_monitoring_specs.exe
test_crud_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_crud_specs
.exe
test_driver.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_driver.exe
test_gridfs_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_gridfs_s
pecs.exe
test_instance.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_instance.exe
test_logging.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_logging.exe
test_mongohouse_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_mong
ohouse_specs.exe
test_read_write_concern_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\t
est_read_write_concern_specs.exe
test_retryable_reads_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test
_retryable_reads_specs.exe
test_transactions_specs.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_tr
ansactions_specs.exe
test_unified_format_spec.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_u
nified_format_spec.exe
test_versioned_api.vcxproj -> C:\Users\dgm55\source\repos\mongo-cxx-driver\build\src\mongocxx\test\Debug\test_version
ed_api.exe
C:\Users\dgm55\source\repos\mongo-cxx-driver\build>