macOS - Qt Creator & Boost

Installing brew/Qt5/Qt Creator/boost

  1. Install Homebrew
    brew.sh

  2. Update brew
    brew update

  3. Install qt5 and boost

    1
    2
    brew install qt5
    brew install boost
  4. Install Qt Creator
    https://www.qt.io/download-open-source/

  5. Inside Qt Creator
    Qt Creator -> Preferences -> Build & Run -> Qt Versions -> Add

5a. Select “Macintosh HD”

5b. Command + Shift + .

5c. /usr/local/Cellar/qt5/<version>/bin/qmake

  1. Select “Kits” -> Add

6a. Compiler -> Clang (x86 64bit)

6b. Qt version -> <version you added in step 5>

  1. OK

Setting up boost in a Qt project

  1. Edit <project name>.pro

  2. Append to the end

    1
    2
    3
    4
    5
    6
    CONFIG += c++11
    QMAKE_CFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.8
    QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.8
    LIBS += -L"/usr/local/Cellar/boost/1.55.0_2/lib"
    INCLUDEPATH += "/usr/local/Cellar/boost/1.55.0_2/include"
  3. Add your boost libs to “LIBS” like so:
    LIBS += -L"/usr/local/Cellar/boost/1.55.0_2/lib" -lboost_random