I get an error running the base C++ code for MongoDB with WIndows 10, Visual Studio 2019

0

I have a problem with running the basic C++ code for MongoDB. Works on Windows 10 with Visual Studio 2019. I was able to add libraries for mongocxx etc thanks to vcpkg.

#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
int main(int, char**) {
    mongocxx::instance instance{}; // This should be done only once.
    mongocxx::uri uri("mongodb://localhost:27017");
    mongocxx::client conn(uri);
    bsoncxx::builder::stream::document document{};
    auto collection = conn["testdb"]["testcollection"];
    document << "hello" << "world";
    collection.insert_one(document.view());
    auto cursor = collection.find({});
    for (auto&& doc : cursor) {
        std::cout << bsoncxx::to_json(doc) << std::endl;
    }
} 

When running this code with mongocxx :: uri uri ("mongodb: // localhost: 27017"); everything works but when it runs with mongocxx :: uri uri ("mongodb + srv: // <username>: <password> @ <cluster-url> / test? retryWrites = true & w = majority" "); (I use the one that works in MongoDBCompass) Error appears.

'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\ConsoleApplication2.exe'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\bsoncxx.dll'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\mongocxx.dll'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\bson-1.0.dll'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\mongoc-1.0.dll'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\secur32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dnsapi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'D:\moje pliki\VS 2019\ConsoleApplication2\Debug\zlibd1.dll'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL'. 
The thread 0x44e0 has exited with code 0 (0x0).
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\NapiNSP.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\pnrpnsp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mswsock.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winrnr.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nlaapi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wshbth.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rasadhlp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\schannel.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mskeyprotect.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncrypt.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntasn1.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\scksp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\credui.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinSCard.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. 
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: unsigned long at memory location 0x003CE0A0.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncryptprov.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winsta.dll'. 
Exception thrown at 0x772546D2 (KernelBase.dll) in ConsoleApplication2.exe: 0x8010002E: Could not find smart card reader.
Exception thrown at 0x772546D2 (KernelBase.dll) in ConsoleApplication2.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: unsigned long at memory location 0x003CDB7C.
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wincredui.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. 
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: unsigned long at memory location 0x0123F734.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rlls.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleacc.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wininet.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. 
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: Win32Util::Error at memory location 0x02DDF7A0.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\umpdc.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.CredDialogController.dll'. 
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: Win32Util::Error at memory location 0x02DDF5C0.
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: Win32Util::Error at memory location 0x02DDF5C0.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.XamlHost.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.Cred.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wincorlib.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MrmCoreR.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextInputFramework.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\InputHost.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\CoreMessaging.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\LanguageOverlayUtil.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\BCP47mrm.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.Xaml.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dcomp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\iertutil.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\BCP47Langs.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\BCP47Langs.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\BCP47Langs.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.Immersive.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\twinapi.appcore.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rmclient.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\urlmon.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXCore.dll'. 
onecore\base\appmodel\statemanager\apiset\lib\statespace.cpp(107)\kernelbase.dll!772298F6: (caller: 77229899) ReturnHr(1) tid(2e58) 80073D54 The process has no package identity
onecore\base\appmodel\statemanager\apiset\lib\statemanager.cpp(53)\kernelbase.dll!77284CA6: (caller: 784630EA) ReturnHr(2) tid(2e58) 80073D54 The process has no package identity.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DWrite.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.Globalization.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\Windows.Globalization.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.Globalization.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\nvldumd.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptnet.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imagehlp.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\nvwgf2um.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\nvwgf2um.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\nvwgf2um.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. 
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
The thread 0x230c has exited with code 0 (0x0).
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\NvCamera\NvCameraWhitelisting32.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_c87780efe1918cc5\NvCamera\NvCameraWhitelisting32.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d2d1.dll'. 
'ConsoleApplication2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\d2d1.dll'
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d2d1.dll'. 
The thread 0x1e68 has exited with code 0 (0x0).
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Windows.UI.Xaml.Controls.dll'. 
Exception thrown at 0x772546D2 (KernelBase.dll) in ConsoleApplication2.exe: 0x40080202: WinRT transform error (parameters: 0x8000000B, 0x80070490, 0x0000001E, 0x0321CA20).
Exception thrown at 0x772546D2 in ConsoleApplication2.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x0321D290.

The program '[10268] ConsoleApplication2.exe' has exited with code 0 (0x0).

Am I skipping a step before running? I noticed that the code stops running at: collection.insert_one(document.view());


EDIT: I started the settings for MongoDB, C ++, Windows with this instructions: http://mongoc.org/libmongoc/current/installing.html and http://mongocxx.org/mongocxx-v3/installation/windows/ however, I did not fully understand it, and I was not able to complete it. then I found information about vcpkg here: in a post from @Joyo Waseem How to set up project with mongodb-cxx-driver in Visual Studio and it all worked for local DBs.But unfortunately, for the connection to the server, there are a few errors, here are some of them.

https://i.stack.imgur.com/0jYq7.png

I'm not sure if I should apply any more settings for Linker and others. I have tried these settings yet:Build a c++ project with mongodb but I think they are unnecessary due to the use of: C:\vcpkg>.\Vcpkg integrate install Tried running VS 2019 as administrator. I held my anti-virus action. I also reached for the oldest form of repair - restarting the computer.


EDIT2 : I installed Visual Studio 2015. Then I set Tools> Options> Debugging> Symbols -> checked the Microsoft Symbol Server option. (I don't know why I found such information somewhere). Now, when trying to run the code, the only message I receive is the window security - smart card. https://i.stack.imgur.com/yeS9O.png I don't have one and I don't know where this message is coming from. Does it result from the settings of the Windows 10 system or from the settings in MongoDB.


EDIT3 : I dusted off my old Windows 7 PC. Installed Visual Studio 2019, setup vcpkg for mongo-cxx-drivers and code run in the first try. Can I somehow use this build and run it worked on the new computer?

'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\cosbedzie.exe'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Program Files (x86)\AVG\Antivirus\x86\aswhook.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\bsoncxx.dll'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\bson-1.0.dll'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-localization-l1-2-0.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-processthreads-l1-1-1.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l1-2-0.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-timezone-l1-1-0.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l2-1-0.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\mongocxx.dll'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\mongoc-1.0.dll'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\secur32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dnsapi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Users\Marcin\source\repos\cosbedzie\Debug\zlibd1.dll'. Symbols loaded.
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. 
The thread 0x1fcc has exited with code 0 (0x0).
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nlaapi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\NapiNSP.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\pnrpnsp.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wshbth.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\Windows Live\WLIDNSP.DLL'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mswsock.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winrnr.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winnsi.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wship6.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rasadhlp.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\credssp.dll'. 
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\cryptsp.dll'
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\schannel.dll'. 
'cosbedzie.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncrypt.dll'. 
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\wship6.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL'
The thread 0x524 has exited with code 0 (0x0).
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\nlaapi.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\NapiNSP.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\pnrpnsp.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\wshbth.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Program Files (x86)\Common Files\microsoft shared\Windows Live\WLIDNSP.DLL'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\shlwapi.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\psapi.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winrnr.dll'
'cosbedzie.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'
The thread 0x240 has exited with code 0 (0x0).
The thread 0x1d78 has exited with code 0 (0x0).
The thread 0x141c has exited with code 0 (0x0).
The program '[7872] cosbedzie.exe' has exited with code 0 (0x0).

EDIT4 : I took all the settings from the old computer now it is left with an error Unhandled exception at 0x761446D2 in nowycalkiem.exe: Microsoft C++ exception: mongocxx::v_noabi::bulk_write_exception at memory location 0x00AFE6AC. and Unhandled exception at 0x761446D2 in nowycalkiem.exe: Microsoft C++ exception: mongocxx::v_noabi::query_exception at memory location 0x00AFEBB8.


EDIT5 : I set up the latest drivers for C ++ (mongo-c-driver-1.17.3, mongo-cxx-driver-r3.6.2) because drivers from vcpkg have: C - 1.16.1 # 3, C ++ - 3.4.0-5 # 1 After following these steps: http://mongoc.org/libmongoc/current/installing.html
http://mongocxx.org/mongocxx-v3/installation/windows/
How to set up Visual Studio project settings with mongo-cxx-driver?
I wrote the code according to this instruction:
http://mongocxx.org/mongocxx-v3/tutorial/

#include <cstdint>
#include <iostream>
#include <vector>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/instance.hpp>
#include <bsoncxx/builder/stream/helpers.hpp>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/builder/stream/array.hpp>


using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;

int main(int, char**) {
 mongocxx::instance inst{};
 mongocxx::client conn{ mongocxx::uri{"mongodb+srv://new:new123@wipcluster.qetq2.mongodb.net/userdata?retryWrites=true&w=majority"} };
 mongocxx::database db = conn["userdata"];
 mongocxx::collection coll = db["test"];
 auto builder = bsoncxx::builder::stream::document{};
 bsoncxx::document::value doc_value = builder
     << "name" << "MongoDB"
     << "type" << "database"
     << "count" << 1
     << "versions" << bsoncxx::builder::stream::open_array
     << "v3.2" << "v3.0" << "v2.6"
     << close_array
     << "info" << bsoncxx::builder::stream::open_document
     << "x" << 203
     << "y" << 102
     << bsoncxx::builder::stream::close_document
     << bsoncxx::builder::stream::finalize;

 bsoncxx::document::view view = doc_value.view();

 bsoncxx::stdx::optional<mongocxx::result::insert_one> result =
     coll.insert_one(view);

}

And the expectation reappeared:
Exception thrown at 0x00007FFC99A73B29 in Project3.exe: Microsoft C++ exception: mongocxx::v_noabi::bulk_write_exception at memory location 0x0000001D6D6FE0C0.

c++
windows
mongodb
visual-studio
compiler-errors
asked on Stack Overflow Jan 1, 2021 by Marcin LeÅ›niewski • edited Jan 5, 2021 by Marcin LeÅ›niewski

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0