MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Using mongo-cxx-driver with VS2013

I’d like to use mongo-cxx-driver 3.5.0 within my project which is compiled by VS2013. Now, I managed to compile mongo-c-driver 1.16.3, mongo-cxx-driver 3.5.0 with VS2015.
Trying run the test example with 2013, I receive hundrets of errors which are not really leading to help. I also considered to upgrade my project to VS2015, but that leads to the same amount of problems.

Is there any recommended way for my case?
Thanks a lot

@Uwe_Dittus, please provide the errors you are seeing. Without those it is hardly even possible to guess at what is going wrong or how to fix it. It would also be helpful to know how you built and installed the C driver and the C++ driver. For example, what commands did you use and were there any warnings or errors in either of those builds?

Hi Roberto, thanks for your reply,

I built:

  • mongo-c-driver, 1.16.3, RelWithDebInfo x32 on VS2015
  • mongo-cxx-driver, 3,5,0, RelWithDebInfo x32 on VS2015

The build log from the code example on VS2013

------ Build started: Project: Project1, Configuration: Debug Win32 ------
Source.cpp
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp(62): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\stdx\string_view.hpp(62): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp(25): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp(25): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\element.hpp(115): error C2039: 'type' : is not a member of 'bsoncxx'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\element.hpp(25): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\element.hpp(25): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp(27): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view.hpp(27): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view.hpp(27): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view.hpp(27): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(25): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(25): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(76): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(76): error C2610: 'bsoncxx::v_noabi::document::value::value(bsoncxx::v_noabi::document::value &&)' : is not a special member function which can be defaulted
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(77): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(77): error C2610: 'bsoncxx::v_noabi::document::value &bsoncxx::v_noabi::document::value::operator =(bsoncxx::v_noabi::document::value &&)' : is not a special member function which can be defaulted
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(82): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(89): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(113): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\value.hpp(117): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(26): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(26): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(77): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(77): error C2610: 'bsoncxx::v_noabi::array::value::value(bsoncxx::v_noabi::array::value &&)' : is not a special member function which can be defaulted
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(78): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(78): error C2610: 'bsoncxx::v_noabi::array::value &bsoncxx::v_noabi::array::value::operator =(bsoncxx::v_noabi::array::value &&)' : is not a special member function which can be defaulted
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(83): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(90): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(108): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\value.hpp(112): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp(25): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp(25): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\decimal128.hpp(45): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(26): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(26): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(66): error C3083: 'stdx': the symbol to the left of a '::' must be a type
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(66): error C2039: 'string_view' : is not a member of 'bsoncxx'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(66): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\oid.hpp(66): error C2143: syntax error : missing ',' before '&'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(29): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(29): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(86): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(86): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111): error C2440: 'initializing' : cannot convert from 'bsoncxx::v_noabi::type' to 'int'
        This conversion requires an explicit cast (static_cast, C-style cast or function-style cast)
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111): error C2439: 'bsoncxx::v_noabi::types::b_utf8::type_id' : member could not be initialized
        d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(111) : see declaration of 'bsoncxx::v_noabi::types::b_utf8::type_id'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(147): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(147): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(147): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(179): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(179): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(179): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(204): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(204): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(204): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(228): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(228): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(228): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(244): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(244): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(262): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(262): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(262): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287): error C2440: 'initializing' : cannot convert from 'bsoncxx::v_noabi::type' to 'int'
        This conversion requires an explicit cast (static_cast, C-style cast or function-style cast)
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287): error C2439: 'bsoncxx::v_noabi::types::b_date::type_id' : member could not be initialized
        d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287) : see declaration of 'bsoncxx::v_noabi::types::b_date::type_id'
        d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287) : see declaration of 'bsoncxx::v_noabi::types::b_date::type_id'
        d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(287) : see declaration of 'bsoncxx::v_noabi::types::b_date::type_id'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(346): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(346): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(346): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(362): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(362): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(362): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(400): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(400): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(400): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(419): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(419): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(419): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(458): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(458): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(458): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(494): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(494): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(494): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(530): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(530): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(530): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(559): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(559): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(559): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(578): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(578): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(578): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(603): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(603): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(603): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(633): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(633): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(633): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(649): error C2144: syntax error : 'auto' should be preceded by ';'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(649): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\types.hpp(649): error C2853: 'type_id' : a non-static data member cannot have a type that contains 'auto'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\core.hpp(31): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\core.hpp(31): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\core.hpp(54): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\core.hpp(55): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\stream\closed_context.hpp(20): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\stream\closed_context.hpp(20): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp(45): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\stdx\optional.hpp(45): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(24): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(24): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(90): error C3646: 'noexcept' : unknown override specifier
        d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(139) : see reference to class template instantiation 'bsoncxx::v_noabi::view_or_value<View,Value>' being compiled
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(101): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\view_or_value.hpp(114): error C3646: 'noexcept' : unknown override specifier
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view_or_value.hpp(25): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view_or_value.hpp(25): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view_or_value.hpp(28): error C2039: 'view_or_value' : is not a member of 'bsoncxx'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view_or_value.hpp(28): error C2143: syntax error : missing ';' before '<'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\array\view_or_value.hpp(28): error C2059: syntax error : '<'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view_or_value.hpp(24): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view_or_value.hpp(24): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view_or_value.hpp(27): error C2039: 'view_or_value' : is not a member of 'bsoncxx'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view_or_value.hpp(27): error C2143: syntax error : missing ';' before '<'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\document\view_or_value.hpp(27): error C2059: syntax error : '<'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(23): warning C4091: 'inline ' : ignored on left of 'int' when no variable is declared
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(23): error C2143: syntax error : missing ';' before 'namespace'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(44): error C2664: 'bsoncxx::v_noabi::document::view::view(const bsoncxx::v_noabi::document::view &)' : cannot convert argument 1 from 'const bsoncxx::v_noabi::document::view_or_value' to 'const bsoncxx::v_noabi::document::view &'
        Reason: cannot convert from 'const bsoncxx::v_noabi::document::view_or_value' to 'const bsoncxx::v_noabi::document::view'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(54): error C2664: 'bsoncxx::v_noabi::document::view::view(const bsoncxx::v_noabi::document::view &)' : cannot convert argument 1 from 'const bsoncxx::v_noabi::document::view_or_value' to 'const bsoncxx::v_noabi::document::view &'
        Reason: cannot convert from 'const bsoncxx::v_noabi::document::view_or_value' to 'const bsoncxx::v_noabi::document::view'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(76): error C2664: 'bsoncxx::v_noabi::array::view::view(const bsoncxx::v_noabi::array::view &)' : cannot convert argument 1 from 'const bsoncxx::v_noabi::array::view_or_value' to 'const bsoncxx::v_noabi::array::view &'
        Reason: cannot convert from 'const bsoncxx::v_noabi::array::view_or_value' to 'const bsoncxx::v_noabi::array::view'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(86): error C2664: 'bsoncxx::v_noabi::array::view::view(const bsoncxx::v_noabi::array::view &)' : cannot convert argument 1 from 'const bsoncxx::v_noabi::array::view_or_value' to 'const bsoncxx::v_noabi::array::view &'
        Reason: cannot convert from 'const bsoncxx::v_noabi::array::view_or_value' to 'const bsoncxx::v_noabi::array::view'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(101): error C2780: '_OutTy *std::move(_InIt,_InIt,_OutTy (&)[_OutSize])' : expects 3 arguments - 1 provided
        c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2510) : see declaration of 'std::move'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(101): error C2780: '_OutIt std::move(_InIt,_InIt,_OutIt)' : expects 3 arguments - 1 provided
        c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2497) : see declaration of 'std::move'
d:\libs\mongo-cxx-driver\3.5.0\include\bsoncxx\v_noabi\bsoncxx\builder\concatenate.hpp(101): fatal error C1003: error count exceeds 100; stopping compilation
Done building project "Project1.vcxproj" -- FAILED.
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@Uwe_Dittus that out put is only for building the code sample. From that, it seems like a preprocessor macro issue. However, without the commands and associated output from the actual builds for the C driver and C++ driver I can only guess. The only idea that comes to me is that something happened with the C++ driver’s config.hpp header. Perhaps it wasn’t configured, perhaps it wasn’t installed. Though, it could be something else entirely. Please provide more details on the build/installation of the drivers so that I can provide a more concrete suggestion.

Don’t know if it should, but including <mongocxx/config/config.hpp> does not help.

Alright… not sure if you exactly asked for this but here comes:

  • cmake cmd for mongo-cxx-driver

d:\mongo-cxx-driver>cmake -G "Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX=d:\mongo-cxx-driver\3.5.0\ -DCMAKE_PREFIX_PATH=d:\LIBS\mongo-c-driver\1.16.3\ -DBOOST_ROOT=d:\LIBS\boost\1.60.0 -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS="/EHsc"

  • These is the bsoncxx_shared.vcxproj, at least the what I guess is the relevant part:

    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
      <ClCompile>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\boost\1.60.0\include;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
        <CompileAs>CompileAsCpp</CompileAs>
        <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
        <ExceptionHandling>Sync</ExceptionHandling>
        <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
        <Optimization>MaxSpeed</Optimization>
        <PrecompiledHeader>NotUsing</PrecompiledHeader>
        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
        <PreprocessorDefinitions>NDEBUG;MONGO_CXX_DRIVER_COMPILING;CMAKE_INTDIR="RelWithDebInfo";BSONCXX_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <ObjectFileName>$(IntDir)</ObjectFileName>
      </ClCompile>
      <ResourceCompile>
        <PreprocessorDefinitions>WIN32;NDEBUG;MONGO_CXX_DRIVER_COMPILING;CMAKE_INTDIR=\"RelWithDebInfo\";BSONCXX_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\boost\1.60.0\include;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      </ResourceCompile>
      <Midl>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\boost\1.60.0\include;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>
        <HeaderFileName>%(Filename).h</HeaderFileName>
        <TypeLibraryName>%(Filename).tlb</TypeLibraryName>
        <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
        <ProxyFileName>%(Filename)_p.c</ProxyFileName>
      </Midl>
      <Link>
        <AdditionalDependencies>D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\lib\bson-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
        <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
        <AdditionalOptions>%(AdditionalOptions) /machine:X86</AdditionalOptions>
        <GenerateDebugInformation>true</GenerateDebugInformation>
        <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
        <ImportLibrary>D:/mongo-cxx-driver/src/bsoncxx/RelWithDebInfo/bsoncxx.lib</ImportLibrary>
        <ProgramDataBaseFile>D:/mongo-cxx-driver/src/bsoncxx/RelWithDebInfo/bsoncxx.pdb</ProgramDataBaseFile>
        <SubSystem>Console</SubSystem>
      </Link>
      <ProjectReference>
        <LinkLibraryDependencies>false</LinkLibraryDependencies>
      </ProjectReference>
    </ItemDefinitionGroup>
    
  • … and the same for mongocxx_shared.vcxproj

    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">
      <ClCompile>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libmongoc-1.0;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;D:\LIBS\boost\1.60.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
        <CompileAs>CompileAsCpp</CompileAs>
        <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
        <ExceptionHandling>Sync</ExceptionHandling>
        <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
        <Optimization>MaxSpeed</Optimization>
        <PrecompiledHeader>NotUsing</PrecompiledHeader>
        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
        <PreprocessorDefinitions>NDEBUG;MONGO_CXX_DRIVER_COMPILING;CMAKE_INTDIR="RelWithDebInfo";MONGOCXX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <ObjectFileName>$(IntDir)</ObjectFileName>
      </ClCompile>
      <ResourceCompile>
        <PreprocessorDefinitions>WIN32;NDEBUG;MONGO_CXX_DRIVER_COMPILING;CMAKE_INTDIR=\"RelWithDebInfo\";MONGOCXX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libmongoc-1.0;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;D:\LIBS\boost\1.60.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      </ResourceCompile>
      <Midl>
        <AdditionalIncludeDirectories>D:\mongo-cxx-driver\src;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libmongoc-1.0;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\include\libbson-1.0;D:\LIBS\boost\1.60.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory>
        <HeaderFileName>%(Filename).h</HeaderFileName>
        <TypeLibraryName>%(Filename).tlb</TypeLibraryName>
        <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
        <ProxyFileName>%(Filename)_p.c</ProxyFileName>
      </Midl>
      <Link>
        <AdditionalDependencies>D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\lib\mongoc-1.0.lib;..\bsoncxx\RelWithDebInfo\bsoncxx.lib;D:\LIBS\mongo-c-driver\1.16.0\msvc-14.0-Win32\lib\bson-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
        <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
        <AdditionalOptions>%(AdditionalOptions) /machine:X86</AdditionalOptions>
        <GenerateDebugInformation>true</GenerateDebugInformation>
        <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
        <ImportLibrary>D:/mongo-cxx-driver/src/mongocxx/RelWithDebInfo/mongocxx.lib</ImportLibrary>
        <ProgramDataBaseFile>D:/mongo-cxx-driver/src/mongocxx/RelWithDebInfo/mongocxx.pdb</ProgramDataBaseFile>
        <SubSystem>Console</SubSystem>
      </Link>
      <ProjectReference>
        <LinkLibraryDependencies>false</LinkLibraryDependencies>
      </ProjectReference>
    </ItemDefinitionGroup>
    

… AND the project file for the code sample:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{82C85CDB-8FDC-4241-8A9F-21C7781D38CF}</ProjectGuid>
    <RootNamespace>Project1</RootNamespace>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>D:\LIBS\boost\1.60.0\include\;D:\LIBS\mongo-c-driver\1.16.3\msvc-14.0-Win32\include\libmongoc-1.0;D:\LIBS\mongo-c-driver\1.16.3\msvc-14.0-Win32\include\libbson-1.0;D:\LIBS\mongo-cxx-driver\3.5.0\msvc-14.0-win32\include\bsoncxx\v_noabi;D:\LIBS\mongo-cxx-driver\3.5.0\msvc-14.0-win32\include\mongocxx\v_noabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AdditionalLibraryDirectories>D:\LIBS\mongo-cxx-driver\3.5.0\msvc-14.0-win32\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
    </ClCompile>
    <Link>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClCompile Include="Source.cpp" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>

OK. I see the problem. The C++ Driver uses the noexcept keyword, which is not supported in MSVC prior to version 2015. For instance, this GitHub issue in another project provides a more detailed explanation. Building the C++ Driver is not supported with MSVC prior to version 2015, so you will need to move from 2013 to a newer version in order successfully build.

1 Like

Kind of funny actually. I had this issue exactly vise versa couple days ago. Soo, anyone tried to override noexcept with throw() ?