Important: Please read the Qt Code of Conduct -

I'm going crazy because of Mac OSX and Qt!

  • My Mac OSX machine with the latest version of Mac OS X has worked perfectly with Qt 5.9.2.
    But today, after a one month without to compile something with this machine and after some Apple uptades, when i try to compile something with Qt I obtain the error:

    error: Qt requires a C++11 compiler and yours does not seem to be that.
    error: "Qt requires C++11 support"

    The command line tools are installed and seems to be ok because I can compile an application using Lazarus / Freepascal.
    I tryed the lates Qt 5.10.0 but I obtain the same error.

    What can I do to resolve?

  • Lifetime Qt Champion


    What version of Xcode are you using ?

  • After Mac updates it is better to make Xcode refresh its tools and components. You can do that from the preferences. If that does not work you may need to go and get the latest command line tools for the Xcode, update Xcode altogether or possibly use and older version of Xcode that better suits the Qt you are using.
    I find that it is usually possible to tweak the latest Xcode to work with the latest versions of Qt.
    I assume you have this "CONFIG += c++11" in you profile just in case?? Not sure if you need that anymore with the latest version of Qt.
    I currently use Qt 5.9.2 on macOS High Sierra version 10.3.3 Xcode version 92 (9C40b) and do not see any problems.
    My Mac also updated to that just recently too...

  • Xcode 9.2, 9C40b
    Latest Command line tools.

    After having update Xcode and the command line tools at the latest version, after having uninstall and reinstall Qt framwerork, I have the same problem.
    Lazarus / Freepascal is working without any problem.

    Please have a look at the attached image.


  • Lifetime Qt Champion

    What does the compile output show ?

  • Please have a look at the above screenshot.

  • I think @SGaist means the output shown in the "4 Compiler Output" window, is that right @SGaist ?
    BTW, why are those paths "/Users/denis/Qt5.9.2/..." etc. different from the others? different install or just the way it being displayed? might not be related to the problem though.

  • @mrdebug

    I'm going crazy because of Mac OSX and Qt!

    Me too!

  • @Diracsbracket you too?

  • Has someone got any idea to solve?

  • @mrdebug
    I've just had a look into the header file qcompilerdetection.h (see this link) as it is the one raising the error in your screenshot. I searched for your error and found only 1 occurence for it in the file:

    559	#ifdef __cplusplus
    560	#  if __cplusplus < 201103L && !defined(Q_CC_MSVC)
    561	#    error Qt requires a C++11 compiler and yours does not seem to be that.
    562	#  endif
    563	#endif

    So, I tried to check the value of __cplusplus in my case, by putting the following in e.g. main.cpp:

    #define DISPLAY_VALUE2(x) #x
    #pragma message(DISPLAY_VALUE(__cplusplus))

    It shows that on my system, the value is 201103L, thus OK.


    What does it show when you use it?

  • @mrdebug
    In addition, the Makefile of my test program has the following line:

    CXXFLAGS      = -pipe -stdlib=libc++ -g -std=gnu++11 $(EXPORT_ARCH_ARGS) -isysroot /Applications/ -mmacosx-version-min=10.10 -Wall -W -fPIC $(DEFINES)

    The interesting part here is -std=gnu++11.
    Would adding QMAKE_CXXFLAGS += -std=gnu++11 in your .pro file make any difference?

  • After may hours spent on searching the solution I have moved the project in another directory. Now the project (without any editing) was been compiled.
    After that I have moved the project in its own default directory. After a clean the project was been compiled without any problem.

  • Lifetime Qt Champion

    What were the paths ?

  • Before

  • Lifetime Qt Champion

    And just moving it fixed the issue ?

  • Yes I do.
    It sounds to be very strange but I don't remember to have did something else.
    I have tried to clean the output directory, by deleting the non visible files without to resolve.

    Really I am very confused.

  • Lifetime Qt Champion

    Strange indeed. Oh well, the essential is that you have it working now.

Log in to reply