Hello,
I’ve been having some trouble installing Mongo-cxx. When using cmake I’m using this command (amongst others I’ve tried):
cmake … \ -G “Visual Studio 16 2019” \ -DBOOST_ROOT=C:\Users\win8\Desktop\boost_1_73_0 -DCMAKE_PREFIX_PATH=C:\mongo-c-driver \ -DCMAKE_INSTALL_PREFIX=c:\mongo-cxx-driver -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_AND_STATIC_LIBS=ON \ -DBUILD_VERSION=3.5.0
Though it is not listed on the installation page, it requires that I put in the build version or otherwise the installation fails, which I set to 3.5.0. I suspect that’s the problem.
In any case, installation always goes smoothly, but after installation, it is missing the necessary libraries “libbsoncxx.lib” and “libmongocxx.lib”. Instead, it has “bsoncxx.lib” and “mongocxx.lib”, which do not work.
Can anyone help me figure out how to get it installing properly?
1 Like
@Andrew_Freitas are you building from a release tarball or from Git? If you are building from a release tarball, the build/
sub-directory contains the file VERSION_CURRENT
which specifies the value of BUILD_VERSION
and which should be found during the build. If you are building from Git, then the build scripts should be able to determine build version from the Git history. However, I just noticed that the installation instructions suggest a shallow Git clone. We need to fix that, as the --depth 1
option is going to throw things off if you build from Git. If you did clone using --depth 1
, then drop that option and clone again.
As far as the libraries not being found, how is your build specifying the location and resources of the C++ driver? Can you provide the complete error output? Also, are you using Visual Studio for all of your builds (C driver, C++ driver, and your own project), or are you mixing Visual Studio and MinGW?
1 Like
I have the some problem here. I am building from release tarball using MS Visual Studio 2019. I installed Mongocxx - Driver 3.5.0 and 3.5.1. Both installation went without any error. However I am missing both librarys (libbsoncxx.lib and libmongocxx.lib). --> only mongocxx.lib and bsoncxx.lib is installed. I used different cmake configuration (during different attempts of installing), including the standard configuration on the installation page.
The Mongoc-Driver was also installed with the help of MS Visual Studio 2019 (libmongoc 1.16.2) and contains every file needed. I am using Visual Studio for everything, including my project. Any ideas to fix this problem and getting both librarys?
1 Like
@Mike_Reichardt the convention on Unix-like systems (including on Windows when using GCC through MSYS or Cygwin) is name libraries something like “libfoo…” (with the suffix being system dependent). When using Windows build tools on Windows, the naming is of the form “foo.lib”. Could you provide a sample program that will not build against the C/C++ driver as you have installed them? Be sure to include the program itself, the build files, and any accompanying output showing the complete build failure.
@Roberto_Sanchez Thank you for your response. I am sorry, if the following text is a bit unstructured, however i am new to writing forum questions.
Here is the test programm
.
The Error Message:
Severity Code Description Project File Line Suppression State
Error C2039 'basic_string_view': is not a member of 'std' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp 98
Error C2873 'basic_string_view': symbol cannot be used in a using-declaration MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp 98
Error C2039 'string_view': is not a member of 'std' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp 99
Error C2873 'string_view': symbol cannot be used in a using-declaration MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp 99
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 124
Error C3646 'key': unknown override specifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 124
Error C2059 syntax error: '(' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 124
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 124
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 344
Error C2061 syntax error: identifier 'string_view' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 344
Error C2805 binary 'operator [' has too few parameters MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp 344
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp 90
Error C2061 syntax error: identifier 'string_view' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp 90
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp 102
Error C2061 syntax error: identifier 'string_view' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp 102
Error C2805 binary 'operator [' has too few parameters MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp 102
Error C2039 'optional': is not a member of 'std' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 83
Error C2873 'optional': symbol cannot be used in a using-declaration MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 83
Error C2039 'nullopt': is not a member of 'std' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 84
Error C2873 'nullopt': symbol cannot be used in a using-declaration MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 84
Error C2039 'make_optional': is not a member of 'std' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 85
Error C2873 'make_optional': symbol cannot be used in a using-declaration MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp 85
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\json.hpp 69
Error C2065 'string_view': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\json.hpp 69
Error C2146 syntax error: missing ')' before identifier 'json' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\json.hpp 69
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 85
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 85
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 85
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 85
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 107
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 107
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 107
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 107
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 127
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 127
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 127
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 127
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 147
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 147
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 147
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\transaction.hpp 147
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 74
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 74
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 74
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 74
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 78
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 78
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 78
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\options\client_session.hpp 78
Error C2039 'optional': is not a member of 'mongocxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\client_session.hpp 125
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\client_session.hpp 125
Error C2143 syntax error: missing ',' before '<' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\client_session.hpp 125
Error C2143 syntax error: missing ')' before '{' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\client_session.hpp 125
Error C2059 syntax error: ')' MongoDB C:\mongo-cxx-driver\include\mongocxx\v_noabi\mongocxx\client_session.hpp 125
Error C2039 'optional': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 137
Error C2143 syntax error: missing ';' before '<' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 137
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 137
Error C2238 unexpected token(s) preceding ';' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 137
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 68
Error C2065 '_value': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 68
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 68
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 74
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 74
Error C2065 '_value': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 74
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 74
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 80
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 81
Error C2065 '_value': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 81
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 81
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 91
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 92
Error C2065 '_value': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 92
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 92
Error C2039 'nullopt': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 94
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 102
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 103
Error C2065 '_value': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 103
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 103
Error C2039 'nullopt': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 105
Error C3861 '_value': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp 115
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 36
Error C2065 'string_view': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 36
Error C2923 'bsoncxx::v_noabi::view_or_value': 'string_view' is not a valid template type argument for parameter 'View' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 36
Error C2955 'bsoncxx::v_noabi::view_or_value': use of class template requires template argument list MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 36
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 41
Error C2065 'string_view': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 41
Error C2923 'bsoncxx::v_noabi::view_or_value': 'string_view' is not a valid template type argument for parameter 'View' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 41
Error C2955 'bsoncxx::v_noabi::view_or_value': use of class template requires template argument list MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 41
Error C3881 can only inherit constructor from direct base MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 41
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 56
Error C2065 'string_view': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 55
Error C2923 'bsoncxx::v_noabi::view_or_value': 'string_view' is not a valid template type argument for parameter 'View' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 56
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 56
Error C3861 'string_view': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 55
Error C2614 'bsoncxx::v_noabi::string::view_or_value': illegal member initialization: 'view_or_value' is not a base or member MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 56
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 69
Error C2065 'string_view': undeclared identifier MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 68
Error C2923 'bsoncxx::v_noabi::view_or_value': 'string_view' is not a valid template type argument for parameter 'View' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 69
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 69
Error C3861 'string_view': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 68
Error C2614 'bsoncxx::v_noabi::string::view_or_value': illegal member initialization: 'view_or_value' is not a base or member MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 69
Error C2039 'view': is not a member of 'bsoncxx::v_noabi::string::view_or_value' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 101
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 101
Error C3861 'string_view': identifier not found MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\string\view_or_value.hpp 101
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp 56
Error C2061 syntax error: identifier 'string_view' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp 56
Error C2535 'bsoncxx::v_noabi::decimal128::decimal128(void)': member function already defined or declared MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp 56
Error C2039 'string_view': is not a member of 'bsoncxx::v_noabi::stdx' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\oid.hpp 66
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\oid.hpp 66
Error C2143 syntax error: missing ',' before '&' MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\oid.hpp 66
Error C1003 error count exceeds 100; stopping compilation MongoDB C:\mongo-cxx-driver\include\bsoncxx\v_noabi\bsoncxx\oid.hpp 66
The configurations are identical to the configuration of the mongo-cxx-installation-guide, except of using foo.lib instead of libfoo.lib, because I don´t have the libfoo.lib files. Here is a picture showing the configuration:
I am new to the forum and would like to know how i can upload or show you the error message quite comfortable instead of copying the complete message in the text box next time.
Hello @Andrew_Freitas,
I am also facing the same issue. Were you able to resolve it? If you resolve please let me know the solution.
Hello @Mike_Reichardt ,
I am also facing the same issue. Were you able to solve it? If yes, then please provide the solution.