Important: Please read the Qt Code of Conduct -

[SOLVED] Can't Find C++ include file(s) when building project in 5.2 on Mac

  • Hello...

    I have a project that was building fine in Qt 5.1, but is having trouble in 5.2. I'm on Mac OS 10.8.5, Xcode 5.0.2, Qt Creator 3.0.0 (Based on Qt 5.2.0), and Qt 5.2.0.

    When I try to build, I get this:

    @In file included from ../PopUpper/main.cpp:6:
    ../PopUpper/utilities.h:3:10: fatal error: 'random' file not found
    #include <random>
    1 error generated.@

    The compile line looks like this:
    @/Applications/ -c -pipe -g -gdwarf-2 -isysroot /Applications/ -mmacosx-version-min=10.8 -Wall -W -fPIE -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../Qt5.2.0/5.2.0/clang_64/mkspecs/macx-clang -I../PopUpper -I../../Qt5.2.0/5.2.0/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I../../Qt5.2.0/5.2.0/clang_64/lib/QtGui.framework/Versions/5/Headers -I../../Qt5.2.0/5.2.0/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/Applications/ -I/Applications/ -I. -I. -F/Projects/Qt5.2.0/5.2.0/clang_64/lib -o main.o ../PopUpper/main.cpp@

    To make it a little clearer, here are the include-related options:

    It looks like the only include path where the relevant include files could be found would be in the <code>-isysroot</code> path. It is on that path at <code>/Applications/</code>.

    For some reason, <code>clang</code> isn't finding it there. The <code>clang</code> version is <code>Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)</code>

    If I use the <code>-v</code> flag on the compile, I see, among other things, the following:
    @#include "..." search starts here:
    #include <...> search starts here:
    /Projects/Qt5.2.0/5.2.0/clang_64/lib (framework directory)
    /Applications/ (framework directory)
    End of search list.@

    The actual include directory isn't listed.

    At this point, I'm at a loss. I could hard-code a path in my <code>.pro</code> file, but that seems like overkill. I'd think qmake would take care of this. It probably <code>is</code> for most people, and I'm hoping someone might venture a guess (or two) as to what's going on.

    I recently reinstalled Xcode 5.0.2 (from the App Store) and Qt 5.2 (from <code>qt-mac-opensource-5.2.0-clang-offline.dmg</code>)

    Can anyone advise...? Thanks!


  • To answer my own question...

    A little more research revealed that the <code>tr1</code> directory is a pre C++11 place to put test include files. In C++11, it's in the main include directory. In Qt 5.1.0 I had specifically put <code>CONFIG+=c++11</code> in the project definition. I added that to my Qt 5.2.0 project definition, and all is well.


Log in to reply