Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -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/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -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:
    @-isysroot
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
    -mmacosx-version-min=10.8
    -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/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
    -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers
    -I.
    -I.
    @

    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/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/tr1/random</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:
    ../../Qt5.2.0/5.2.0/clang_64/mkspecs/macx-clang
    ../PopUpper
    ../../Qt5.2.0/5.2.0/clang_64/lib/QtWidgets.framework/Versions/5/Headers
    ../../Qt5.2.0/5.2.0/clang_64/lib/QtGui.framework/Versions/5/Headers
    ../../Qt5.2.0/5.2.0/clang_64/lib/QtCore.framework/Versions/5/Headers
    .
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers
    /Projects/Qt5.2.0/5.2.0/clang_64/lib (framework directory)
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/backward
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks (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!

    -Eric



  • 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.

    whew


Log in to reply