Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1762

Compilation problems

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.3.0
    • Component/s: Build
    • None
    • Environment:
      Linux Mint 19.1, CMake 3.10.2, G++ 7.0.4, Lib BSON 1.0, Lib Mongo C 1.0, BSON CXX and Mongo CXX 13.0

      I have installed Mongo C and Mongo CXX drivers for C++. Whe  I was testing the installation I had receive the error:

      [ 50%] Building CXX object CMakeFiles/Proto-buffer.dir/source/classes/connection/connection.cpp.o
      /home/pc/Downloads/Proto-buffer/source/classes/connection/connection.cpp:7:10: fatal error: bsoncx
      x/json.hpp: No such file or directory
       #include <bsoncxx/json.hpp>
       ^~~~~~~~~~~~~~~~~~
      compilation terminated.
      CMakeFiles/Proto-buffer.dir/build.make:62: recipe for target 'CMakeFiles/Proto-buffer.dir/source/c
      lasses/connection/connection.cpp.o' failed
      make[2]: *** [CMakeFiles/Proto-buffer.dir/source/classes/connection/connection.cpp.o] Error 1
      CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Proto-buffer.dir/all' failed
      make[1]: *** [CMakeFiles/Proto-buffer.dir/all] Error 2
      Makefile:83: recipe for target 'all' failed
      make: *** [all] Error 2
      

       My CPP file:

      #include <cstdint>
      #include <iostream>
      #include <vector>
      #include <bsoncxx/json.hpp>
      #include <mongocxx/client.hpp>
      #include <mongocxx/stdx.hpp>
      #include <mongocxx/uri.hpp>
      
      int main(const int argc, const char *argv[]) {
      mongocxx::uri uri("mongodb://localhost:27017");
      mongocxx::client client(uri);
      }
      

       
      My CMakeList file:
       

      # Project
      CMAKE_MINIMUM_REQUIRED(VERSION 3.10.2)
      
      PROJECT(Proto-buffer CXX)
      
      SET(CMAKE_CXX_STANDARD 17)
      
      set(CMAKE_CXX_EXTENSIONS OFF)
      
      # Libraries
      FIND_PACKAGE(libmongocxx REQUIRED)
      
      FIND_PACKAGE(libbsoncxx REQUIRED)
      
      INCLUDE_DIRECTORIES(${LIBMONGOCXX_INCLUDE_DIR})
      
      INCLUDE_DIRECTORIES(${LIBBSONCXX_INCLUDE_DIR})
      
      INCLUDE_DIRECTORIES("/usr/local/include/mongocxx/v_noabi/mongocxx")
      
      INCLUDE_DIRECTORIES("/usr/local/include/bsoncxx/v_noabi/bsoncxx")
      
      INCLUDE_DIRECTORIES("/usr/local/include/libmongoc-1.0")
      
      INCLUDE_DIRECTORIES("/usr/local/include/libbson-1.0")
       # Executables
      ADD_EXECUTABLE(${PROJECT_NAME} ./source/classes/connection/connection.cpp
      

      How can I fix this? (for more details read this).

            Assignee:
            Unassigned Unassigned
            Reporter:
            sphinxs sphinxs
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: