Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMAKE_CXX_COMPILER incorrectly set to C Compiler in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

CMAKE_CXX_COMPILER incorrectly set to C Compiler in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wrosecrans
    wrote on last edited by
    #1

    I have seen this happen on two different machines, so I think it may be a Qt Creator bug, but I don't fully understand what's happening.
    On my Linux box, it set the CMAKE_CXX_COMPILER to gcc rather than g++. On OS-X, I was trying to use Clang, and it was set to clang rather than clang++.

    So, using Qt Creator 4.8.1 on OS-X 10.14.2,

    cmake --version
    cmake version 3.13.3

    I can't reproduce the issue outside of Qt Creator so far, so I don't think it's a cmake issue, or an issue with how the compilers are installed. If I inspect Qt Creator's Preferences -> Kits -> Compilers display, and look under C++, Qt Creator seems to be pointing at proper names for C++ compilers . (g++, or clang++, sometimes with a version number in the name, but not the C compiler)

    If I open up a CMake project in Qt Creator, and try to build, I get weird linker errors that are ultimately because the C++ standard library isn't being linked. (Manifests with slightly different error messages between gcc and clang on Linux vs. OS-X). After much angry yelling and insisting that the problem is impossible, because I can build on the command line with no problem using cmake, so I know the CMakeLists.txt is valid. The project in the CMakelists.txt specifies that the language is "CXX" so the source isn't being misidentified as C by CMake.

    But, if you look under Qt Creator's Projects Build&Run settings, and you click the "advanced" tickbox to see all of the settings that are normally hidden, I will see for example:

    CMAKE_CXX_COMPILER is set to "/usr/local/Cellar/llvm/7.0.1/bin/clang-7"

    In the case I am looking at right now, it's using a version of clang using brew from /usr/local, but like I mentioned I have seen basically the same issue on an Ubuntu box with gcc installed with apt, so I don't think it's anything to do with the specific compiler installed from brew.

    Have other folks run into this? Do they understand the causes? How can I prevent it? Drives me crazy when it happens, and I waste a bunch of time figuring out what on earth is going wrong, and then having to manually edit the setting for every build configuration.

    halps!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Pretty intriguing... Can you provide a minimal compilable example that triggers this ?

      Also, did you already check the bug report system for something similar ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved