Building and installing MongoDB C++ driver in OS X

前端 未结 1 1474
傲寒
傲寒 2021-02-06 16:21

I have downloaded the latest version of MongoDB C++ driver for my os x from http://dl.mongodb.org/dl/cxx-driver. Then I extracted using tar xvf command in os x terminal. After t

1条回答
  •  日久生厌
    2021-02-06 16:52

    It took me a while to get this working. Hopefully you can get yours working from the following steps:

    Create a new C++ project in Xcode

    I copied the code from /src/mongo/client/examples/tutorial.cpp as a test

    In Build Settings/Search Paths:

    screen shot of search paths

    Add the following to your Header Search Paths:

    /path/to/mongo-cxx-driver-nightly/src
    

    and your equivalent path for the boost library header files (the folder should contain a boost folder):

    /usr/local/Cellar/boost/1.54.0/include
    

    Add the following to your Library Search Paths:

    /usr/local/lib (in my case holds all of the boost libraries)
    /path/to/mongo-cxx-driver-nightly
    

    Link Binaries

    In the Build Phases/Link Binary with Libraries settings:

    Screen shot of build phases

    Add the following binaries:

    /path/to/mongo-cxx-driver-nightly/libmongoclient.a
    /usr/local/lib/libboost_thread-mt.dylib
    /usr/local/lib/libboost_system-mt.dylib
    /usr/local/lib/libboost_filesystem-mt.dylib
    /usr/local/lib/libboost_program_options-mt.dylib
    

    0 讨论(0)
提交回复
热议问题