2

I have installed mongocxx with the instructions here on Ubuntu 14.04

/usr/local/lib has libbsoncxx.so , libmongoc-1.0.so and libmongocxx.so

I am using cmake to compile the simple example in the instructions

cmake_minimum_required(VERSION 3.6)
project(mongotest)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(mongotest ${SOURCE_FILES})
target_link_libraries(mongotest libmongoc libmongocxx libbson)

or even (since new to cmake)

gcc -lmongoc-1.0 -lbsoncxx -lmongocxx main.cpp

The example is :

#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;
    }
}

I am getting this error ... which I have been unable to solve

 fatal error: bsoncxx/builder/stream/document.hpp: No such file or    directory

Any ideas - I can't seem to link the mongocxx driver ?

EDIT

followed instructions here

STEP 1 : Install Mongoc driver

sudo apt-get install pkg-config libssl-dev libsasl2-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libsasl2-dev is already the newest version.
pkg-config is already the newest version.
libssl-dev is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.


wget https://github.com/mongodb/mongo-c-        driver/releases/download/1.4.2/mongo-c-driver-1.4.2.tar.gz
$ tar xzf mongo-c-driver-1.4.2.tar.gz
$ cd mongo-c-driver-1.4.2
$ ./configure

libmongoc 1.4.2 was configured with the following options:

Build configuration:
  Enable debugging (slow)                          : no
  Compile with debug symbols (slow)                : no
  Enable GCC build optimization                    : yes
  Enable automatic binary hardening                : yes
  Enable automatic init and cleanup                : yes
      DEPRECATED: use --disable-automatic-init-and-cleanup
  Code coverage support                            : no
  Cross Compiling                                  : no
  Fast counters                                    : no
  Shared memory performance counters               : yes
  SASL                                             : sasl2
  SSL                                              : openssl
  Libbson                                          : system

Documentation:
  man                                              : no
  HTML                                             : no

make
sudo make install
make[1]: Entering directory `/home/avrono/ClionProjects/mongo-c-    driver-1.4.2'
make[2]: Entering directory `/home/avrono/ClionProjects/mongo-c-driver-1.4.2'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   libmongoc-    1.0.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libmongoc-1.0.so.0.0.0     /usr/local/lib/libmongoc-1.0.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libmongoc-    1.0.so.0.0.0 libmongoc-1.0.so.0 || { rm -f libmongoc-1.0.so.0 && ln -s     libmongoc-1.0.so.0.0.0 libmongoc-1.0.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libmongoc-    1.0.so.0.0.0 libmongoc-1.0.so || { rm -f libmongoc-1.0.so && ln -s     libmongoc-1.0.so.0.0.0 libmongoc-1.0.so; }; })
libtool: install: /usr/bin/install -c .libs/libmongoc-1.0.lai     /usr/local/lib/libmongoc-1.0.la
libtool: finish:     PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin"     ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/bin'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c mongoc-stat     '/usr/local/bin'
libtool: install: /usr/bin/install -c mongoc-stat     /usr/local/bin/mongoc-stat
 /bin/mkdir -p '/usr/local/include/libmongoc-1.0'
 /usr/bin/install -c -m 644 src/mongoc/mongoc.h src/mongoc/mongoc-    apm.h src/mongoc/mongoc-apm-private.h src/mongoc/mongoc-array-private.h     src/mongoc/mongoc-async-private.h src/mongoc/mongoc-async-cmd-private.h     src/mongoc/mongoc-b64-private.h src/mongoc/mongoc-buffer-private.h     src/mongoc/mongoc-bulk-operation-private.h src/mongoc/mongoc-bulk-    operation.h src/mongoc/mongoc-client-pool.h src/mongoc/mongoc-client-pool-    private.h src/mongoc/mongoc-client-private.h src/mongoc/mongoc-client.h     src/mongoc/mongoc-cluster-private.h src/mongoc/mongoc-collection-private.h     src/mongoc/mongoc-collection.h src/mongoc/mongoc-counters-private.h     src/mongoc/mongoc-cursor-array-private.h src/mongoc/mongoc-cursor-    cursorid-private.h src/mongoc/mongoc-cursor-transform-private.h     src/mongoc/mongoc-cursor-private.h src/mongoc/mongoc-cursor.h     src/mongoc/mongoc-crypto-private.h src/mongoc/mongoc-database-private.h     src/mongoc/mongoc-database.h src/mongoc/mongoc-errno-private.h     src/mongoc/mongoc-error.h src/mongoc/mongoc-find-and-modify-private.h     src/mongoc/mongoc-find-and-modify.h src/mongoc/mongoc-flags.h     src/mongoc/mongoc-gridfs-file-list-private.h src/mongoc/mongoc-gridfs-    file-list.h src/mongoc/mongoc-gridfs-file-page-private.h     src/mongoc/mongoc-gridfs-file-page.h src/mongoc/mongoc-gridfs-file-    private.h src/mongoc/mongoc-gridfs-file.h src/mongoc/mongoc-gridfs-    private.h src/mongoc/mongoc-gridfs.h src/mongoc/mongoc-host-list-private.h     '/usr/local/include/libmongoc-1.0'
 /usr/bin/install -c -m 644 src/mongoc/mongoc-host-list.h     src/mongoc/mongoc-index.h src/mongoc/mongoc-init.h src/mongoc/mongoc-    iovec.h src/mongoc/mongoc-list-private.h src/mongoc/mongoc-log.h     src/mongoc/mongoc-log-private.h src/mongoc/mongoc-matcher-op-private.h     src/mongoc/mongoc-matcher-private.h src/mongoc/mongoc-matcher.h     src/mongoc/mongoc-memcmp-private.h src/mongoc/mongoc-opcode.h     src/mongoc/mongoc-opcode-private.h src/mongoc/mongoc-queue-private.h     src/mongoc/mongoc-read-concern-private.h src/mongoc/mongoc-read-concern.h     src/mongoc/mongoc-read-prefs-private.h src/mongoc/mongoc-read-prefs.h     src/mongoc/mongoc-rpc-private.h src/mongoc/mongoc-sasl-private.h     src/mongoc/mongoc-scram-private.h src/mongoc/mongoc-server-description.h     src/mongoc/mongoc-server-description-private.h src/mongoc/mongoc-server-    stream-private.h src/mongoc/mongoc-set-private.h src/mongoc/mongoc-    socket.h src/mongoc/mongoc-socket-private.h src/mongoc/mongoc-stream-    buffered.h src/mongoc/mongoc-stream-file.h src/mongoc/mongoc-stream-    gridfs.h src/mongoc/mongoc-stream-private.h src/mongoc/mongoc-stream-    socket.h src/mongoc/mongoc-stream.h src/mongoc/mongoc-thread-private.h     src/mongoc/mongoc-topology-description-private.h src/mongoc/mongoc-    topology-private.h src/mongoc/mongoc-topology-scanner-private.h     src/mongoc/mongoc-trace.h src/mongoc/mongoc-trace-private.h     src/mongoc/mongoc-uri.h '/usr/local/include/libmongoc-1.0'
 /usr/bin/install -c -m 644 src/mongoc/mongoc-uri-private.h     src/mongoc/mongoc-util-private.h src/mongoc/mongoc-version.h     src/mongoc/mongoc-version-functions.h src/mongoc/mongoc-write-command-    private.h src/mongoc/mongoc-write-concern-private.h src/mongoc/mongoc-    write-concern.h src/mongoc/utlist.h src/mongoc/mongoc-crypto-cng-private.h     src/mongoc/mongoc-crypto-common-crypto-private.h src/mongoc/mongoc-crypto-    openssl-private.h src/mongoc/mongoc-openssl-private.h src/mongoc/mongoc-    rand.h src/mongoc/mongoc-rand-private.h src/mongoc/mongoc-secure-channel-    private.h src/mongoc/mongoc-secure-transport-private.h src/mongoc/mongoc-    ssl.h src/mongoc/mongoc-ssl-private.h src/mongoc/mongoc-stream-tls.h     src/mongoc/mongoc-stream-tls-openssl-bio-private.h src/mongoc/mongoc-    stream-tls-openssl.h src/mongoc/mongoc-stream-tls-openssl-private.h     src/mongoc/mongoc-stream-tls-private.h src/mongoc/mongoc-stream-tls-    secure-channel.h src/mongoc/mongoc-stream-tls-secure-channel-private.h     src/mongoc/mongoc-stream-tls-secure-transport.h src/mongoc/mongoc-stream-    tls-secure-transport-private.h src/mongoc/op-delete.def src/mongoc/op-get-    more.def src/mongoc/op-header.def src/mongoc/op-insert.def src/mongoc/op-    kill-cursors.def src/mongoc/op-msg.def src/mongoc/op-query.def     src/mongoc/op-reply.def src/mongoc/op-reply-header.def src/mongoc/op-    update.def src/mongoc/mongoc-counters.defs src/mongoc/mongoc-config.h     '/usr/local/include/libmongoc-1.0'
 /bin/mkdir -p '/usr/local/share/doc/mongo-c-driver'
 /usr/bin/install -c -m 644 COPYING NEWS README.rst     '/usr/local/share/doc/mongo-c-driver'
 /bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 ./src/libmongoc-1.0.pc ./src/libmongoc-    ssl-1.0.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory `/home/avrono/ClionProjects/mongo-c-driver-    1.4.2'
make[1]: Leaving directory `/home/avrono/ClionProjects/mongo-c-driver-    1.4.2'

STEP 2: Build Mongcxx dirver

curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.2.tar.gz
tar -xzf r3.0.2.tar.gz
cd mongo-cxx-driver-r3.0.2/build


cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
-- The CXX compiler identification is GNU 4.9.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking for module 'libbson-1.0>=1.3.4'
--   Found libbson-1.0, version 1.4.2
-- Found LIBBSON: TRUE  
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Checking for module 'libmongoc-1.0>=1.3.4'
--   Found libmongoc-1.0, version 1.4.2
-- Found LIBMONGOC: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/avrono/ClionProjects/mongo-    cxx-driver-r3.0.2/build

Step 3 : Build and install the driver

sudo make EP_mnmlstc_core
Scanning dependencies of target EP_mnmlstc_core
[ 33%] Creating directories for 'EP_mnmlstc_core'
[ 33%] Performing download step (git clone) for 'EP_mnmlstc_core'
-- EP_mnmlstc_core download command succeeded.  See also     /home/avrono/ClionProjects/mongo-cxx-driver-    r3.0.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-    prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-download-*.log
[ 66%] No patch step for 'EP_mnmlstc_core'
[ 66%] No update step for 'EP_mnmlstc_core'
[ 66%] Performing configure step for 'EP_mnmlstc_core'
-- EP_mnmlstc_core configure command succeeded.  See also     /home/avrono/ClionProjects/mongo-cxx-driver-    r3.0.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-    prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-configure-*.log
[ 66%] Performing build step for 'EP_mnmlstc_core'
    -- EP_mnmlstc_core build command succeeded.  See also      /home/avrono/ClionProjects/mongo-cxx-driver-     r3.0.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-     prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-build-*.log
    [ 66%] Performing install step for 'EP_mnmlstc_core'
-- EP_mnmlstc_core install command succeeded.  See also  /home/avrono/ClionProjects/mongo-cxx-driver- r3.0.2/build/src/bsoncxx/third_party/EP_mnmlstc_core- prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log
[100%] Performing fix-includes step for 'EP_mnmlstc_core'
[100%] Completed 'EP_mnmlstc_core'
[100%] Built target EP_mnmlstc_core


make && sudo make install
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/include/bsoncxx/v_noabi/bsoncxx
-- Up-to-date: /usr/local/include/bsoncxx/v_noabi/bsoncxx/config
-- Installing:     /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp
-- Installing:     /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/stdx
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/stdx/string_view.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/stdx/optional.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/stdx/make_unique.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/types.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/cmake
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/enums
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/enums/binary_sub_type.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/enums/type.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/types
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/types/value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/util
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/util/functor.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/array
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/array/view_or_value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/oid.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/document
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/document/view.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/document/view_or_value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/json.hpp
-- Up-to-date: /usr/local/include/bsoncxx/v_noabi/bsoncxx/third_party
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/validate.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array_context.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/closed_context.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/impl.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_document.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/helpers.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/kvp.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_array.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/string
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/exception
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/exception/error_code.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/export.hpp
-- Installing: /usr/local/lib/libbsoncxx.so.3.0.2
-- Up-to-date: /usr/local/lib/libbsoncxx.so._noabi
-- Up-to-date: /usr/local/lib/libbsoncxx.so
-- Set runtime path of "/usr/local/lib/libbsoncxx.so.3.0.2" to "/usr/local/lib"
-- Installing: /usr/local/lib/libbsoncxx.a
-- Installing: /usr/local/lib/cmake/libbsoncxx-3.0.2/libbsoncxx-config.cmake
-- Installing: /usr/local/lib/cmake/libbsoncxx-3.0.2/libbsoncxx-config-version.cmake
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/config.hpp
-- Installing: /usr/local/include/bsoncxx/v_noabi/bsoncxx/config/version.hpp
-- Installing: /usr/local/lib/pkgconfig/libbsoncxx.pc
-- Up-to-date: /usr/local/include/mongocxx/v_noabi/mongocxx
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/uri.hpp
-- Up-to-date: /usr/local/include/mongocxx/v_noabi/mongocxx/config
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/write_concern.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/cmake
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/pool.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/read_concern.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/update.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/replace_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/bulk_write.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/insert_many.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/delete.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/result/insert_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/stdx.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/write.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/delete_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/update_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/replace_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/delete_many.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/update_many.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/model/insert_one.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/modify_collection.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/distinct.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/update.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/ssl.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/bulk_write.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/client.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/index.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/count.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/find_one_common_options.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/create_collection.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/insert.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/aggregate.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/find.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/options/delete.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/pipeline.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/bulk_write.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/client.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/collection.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/cursor.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/database.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/write_type.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/hint.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/instance.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/validation_criteria.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/logger.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/read_preference.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/query_exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/write_exception.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/server_error_code.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/logic_error.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/exception/error_code.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/insert_many_builder.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/export.hpp
-- Installing: /usr/local/lib/libmongocxx.so.3.0.2
-- Up-to-date: /usr/local/lib/libmongocxx.so._noabi
-- Up-to-date: /usr/local/lib/libmongocxx.so
-- Set runtime path of "/usr/local/lib/libmongocxx.so.3.0.2" to "/usr/local/lib"
-- Installing: /usr/local/lib/libmongocxx.a
-- Installing: /usr/local/lib/cmake/libmongocxx-3.0.2/libmongocxx-config.cmake
-- Installing: /usr/local/lib/cmake/libmongocxx-3.0.2/libmongocxx-config-version.cmake
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/config.hpp
-- Installing: /usr/local/include/mongocxx/v_noabi/mongocxx/config/version.hpp
-- Installing: /usr/local/lib/pkgconfig/libmongocxx.pc
avrono
  • 1,648
  • 3
  • 19
  • 40
  • You forget about the last part of compile line: `$(pkg-config --cflags --libs libmongocxx)`. CMake has module `FindPkgCofig` with functionality similar to pkg-config. See [example](http://stackoverflow.com/questions/35457533/findpkgconfig-with-set-target-properties-is-unusable-for-setting-cflags-ldflags/35476270#35476270) of its usage. – Tsyvarev Oct 25 '16 at 17:05
  • Same error and tried to `export PKG_CONFIG_PATH="/usr/local/lib"` – avrono Oct 26 '16 at 08:34
  • What output of `pkg-config --cflags libmongocxx` is? It should contain something like `-I /usr/local/include` among other options. Check, that given directory (`/usr/local/include`) contains the header (that is, absolute path `/usr/local/include/bsoncxx/builder/stream/document.hpp` points to a real file). – Tsyvarev Oct 26 '16 at 08:52
  • The output is `-I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/bsoncxx/v_noabi` The header files are not there – avrono Oct 26 '16 at 09:44
  • According to script [src/bsoncxx/CMakeLists.txt](https://github.com/mongodb/mongo-cxx-driver/blob/master/src/bsoncxx/CMakeLists.txt), *mongocxx* installs bsoncxx-related headers into `/usr/local/include/bsoncxx/v_noabi`, so accessing them requires to omit `bsoncxx/` prefix. But the headers themselves uses this prefix... Looks like the *project is in incosistent state*. You may try to create soft link `ln -s . bsoncxx` in `/usr/local/include/bsoncxx/v_noabi` directory, so paths to header files will be valid. – Tsyvarev Oct 26 '16 at 10:20
  • @Tsyvarev thanks for the help, looks like there are "issues" , thought it might be something "silly" I was doing .... – avrono Oct 26 '16 at 10:26
  • Hm, I after the testing I find my previous comment wrong: header files are installed correctly. E.g. the file caused the fatal error should be located at `/usr/local/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp`. So it should be found with `-I/usr/local/include/bsoncxx/v_noabi` option to the compiler. Check that given file actually exists on your machine. – Tsyvarev Oct 26 '16 at 10:50
  • the directory `/usr/local/include/bsoncxx/v_noabi/bsoncxx` has only two directories `config` and `third_party` - no header files – avrono Oct 26 '16 at 12:47
  • These header files should be installed with `sudo make install`. – Tsyvarev Oct 26 '16 at 13:08
  • 1
    Can you share the exact commands you used to build and install mongocxx and the output you got? That would make it easier to diagnose what went wrong. – xdg Oct 26 '16 at 13:53
  • @xdg I followed the instructions here https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ , I'll try `make clean` and edit question above with details – avrono Oct 26 '16 at 14:25
  • @xdg once I did it all again, it now works ... :-) – avrono Oct 26 '16 at 15:05
  • Thanks for trying again and I'm glad it worked. If you figure out what happened and have suggestions for the docs to help the next person avoid it, please let us know. – xdg Oct 27 '16 at 13:31

0 Answers0