Cannot compile mongo cxx driver in visual studio

167 views
Skip to first unread message

Ricardo Monicat

unread,
Jan 24, 2020, 5:13:35 AM1/24/20
to mongodb-user
Started by commenting in Stack Overflow. I'll reproduce here my original comment. 


I followed the instructions provided on the site.


Added -DENABLE_EXTRA_ALIGNMENT=OFF" to the CMake parameters to fix a previous bug reported, as recommended by technicians at Mongodb.


On the last run, error 2440 happened in "transaction.hh" lines 64, 77, 90. It cannot convert from 'initializer list' to 'std::optional<mongocxx::v_noabi::read_concern>'{.


I am using Microsoft Visual Studio Community 2019 Versión 16.4.3.


The used script for cpp driver is:


cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="/Zc:__cplusplus" -DBOOST_ROOT=C:\local\boost_1_60_0 -DCMAKE_PREFIX_PATH=C:\mongo-c-driver -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver


"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" ALL_BUILD.vcxproj


"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" INSTALL.vcxproj

Andrew Morrow

unread,
Jan 24, 2020, 2:16:07 PM1/24/20
to mongod...@googlegroups.com

Hi -

What version of the driver are you building?

Thanks,
Andrew

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/93cd66bc-2603-4510-b7a2-84295ad9522e%40googlegroups.com.

Ricardo Monicat

unread,
Jan 25, 2020, 6:48:15 AM1/25/20
to mongodb-user
Hi, good morning

Version 1-16-0

Thank you,

Ricardo
To unsubscribe from this group and stop receiving emails from it, send an email to mongod...@googlegroups.com.

Ricardo Monicat

unread,
Jan 26, 2020, 10:21:47 PM1/26/20
to mongodb-user
Sorry, c++ driver version is 3.4.0.  I tried to build it with vs 2019 and 2017, getting the same result. 

Andrew Morrow

unread,
Jan 27, 2020, 10:14:12 AM1/27/20
to mongod...@googlegroups.com

Hi -

Did you see the reply on your stackoverflow question that pointed you to https://jira.mongodb.org/browse/CXX-1688 and https://jira.mongodb.org/browse/CXX-1737? The issue was fixed in 3.4.1. Try upgrading to that and see if the issue is resolved?

Thanks,
Andrew


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/4740764c-cb52-4a4c-b4ee-91581ee5a6ce%40googlegroups.com.

Ricardo Monicat

unread,
Feb 9, 2020, 4:18:51 PM2/9/20
to mongodb-user

Hi,

Thanks for your reply and sorry for my delay, this is part of an assessment activity and during last days, it´s priority was surpassed by other urgencies.
Hands back to the matter, I followed your suggestion.

step 1:
Update to commit 913a419 as suggested in https://jira.mongodb.org/browse/CXX-1688
Outcome: 
  .... \src\mongocxx\test\transactions.cpp(93,5): error C2065: '_That': identificador no declarado [C:\instalamongo\version\cmake-build\src\mongocxx\test\test_driver.vcxproj]
  .... \src\mongocxx\test\transactions.cpp(123,31): error C3536: 'successful_insert_test': no se puede usar antes de inicializarse [C:\instalamongo\version\cmake-build\src\mongocxx\test\test_driver.vcxproj]
  .... \src\mongocxx\test\transactions.cpp(123,9): error C2064: el t‚rmino no se eval£a como una funci¢n con 2 argumentos [C:\instalamongo\version\cmake-build\src\mongocxx\test\test_driver.vcxproj]
  .... \src\mongocxx\test\transactions.cpp(132,9): error C2064: el t‚rmino no se eval£a como una funci¢n con 2 argumentos [C:\instalamongo\version\cmake-build\src\mongocxx\test\test_driver.vcxproj]
  .... \src\mongocxx\test\transactions.cpp(139,9): error C2064: el t‚rmino no se eval£a como una funci¢n con 2 argumentos [C:\instalamongo\version\cmake-build\src\mongocxx\test\test_driver.vcxproj]


Step 2: 
found commit 124f9d0 fixing transactions.cpp.
It can be traced back to commit 913a419 following: 124f9d0 -> 0d3fca4 -> 96dbc39 -> 913a419  
Good!!! It compiled, only warnings.

Step 3: 
Followed ahead the commits chain to 839098a as a more updated version.
Again, it compiled, only warnings.

After these steps, I believe the compiling issue is resolved and I will continue testing the integration of Mongo dB as one of the tools of the project.

Only as a comment to share: Ok with bugs, that's live!!, but I feel a bit uncomfortable not having a release version that just compiles.

Thank you again for your reply.

Br,

Ricardo

El viernes, 24 de enero de 2020, 7:13:35 (UTC-3), Ricardo Monicat escribió:
Reply all
Reply to author
Forward
0 new messages