[CXX-1750] types.hpp E0145 error Created: 28/Mar/19  Updated: 27/Oct/23  Resolved: 02/Apr/19

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: 3.4.0
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Konrad Assignee: Unassigned
Resolution: Gone away Votes: 0
Labels: VisualStudio, mongocxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Visual Studio 2017 Community


Attachments: PNG File mongocxx.png    

 Description   

Hi,

I have no idea why cannot build test mongocxx program via Visual Studio:

#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 inst{};
    mongocxx::client conn{mongocxx::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;
    }
}

My configuration: 

platform: x64

additional libraries: C:\mongo-cxx-driver\lib

additional header files: C:\mongo-cxx-driver\include\bsoncxx\v_noabi;

C:\mongo-cxx-driver\include\mongocxx\v_noabi; C:\boost\boost_1_62_0

(tried with includes from mongo-c-driver but nothing changed)

Visual inform that member bsoncxx::v_noabi::types::xxx::type_id cannot be initialized (xxx-different types like b_double, b_binary etc.).

I attach screenshot with listed errors (in polish but i translated main issue above) and code in types.hpp where the problem is.



 Comments   
Comment by Konrad [ 02/Apr/19 ]

Errors disappeared by refreshing couple times the project. I don't know what's the reason of such bahaviour of Visual Studio but program successfully run on both Platforms (x86 and x64).

Generated at Wed Feb 07 22:03:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.