Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. macOS using Homebrew 'c++' compiler

macOS using Homebrew 'c++' compiler

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 3 Posters 982 Views
  • 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.
  • K Offline
    K Offline
    KyleRoth
    wrote on 30 Mar 2022, 20:02 last edited by KyleRoth
    #1

    I am working on OSX (Monterey 12.3) and use Qt 6.2.3. The project I am working on requires me to use 'expint()' from the 'math.h' default cpp library. However, clang (the default apple compiler) does not implement this function. Installing gcc from homebrew, and using the 'c++' compiler, I am able to use the 'expint()' function.
    Then, modifying the kit to use this compiler causes problems in Qt Creator. When qmake is run I get, ":-1: error: Project ERROR: failed to parse default search paths from compiler output".
    When searching for this problem online, all the forums say "Use clang". But, clang won't work for this project. How can I get 'c++' to work?
    Thank you in advance

    J 1 Reply Last reply 31 Mar 2022, 06:12
    0
    • K KyleRoth
      30 Mar 2022, 20:02

      I am working on OSX (Monterey 12.3) and use Qt 6.2.3. The project I am working on requires me to use 'expint()' from the 'math.h' default cpp library. However, clang (the default apple compiler) does not implement this function. Installing gcc from homebrew, and using the 'c++' compiler, I am able to use the 'expint()' function.
      Then, modifying the kit to use this compiler causes problems in Qt Creator. When qmake is run I get, ":-1: error: Project ERROR: failed to parse default search paths from compiler output".
      When searching for this problem online, all the forums say "Use clang". But, clang won't work for this project. How can I get 'c++' to work?
      Thank you in advance

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 31 Mar 2022, 06:12 last edited by
      #2

      @KyleRoth You can't mix C++ compilers. If you want to use GCC as compiler then you will also need to build Qt with this compiler.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply 31 Mar 2022, 15:18
      1
      • J jsulm
        31 Mar 2022, 06:12

        @KyleRoth You can't mix C++ compilers. If you want to use GCC as compiler then you will also need to build Qt with this compiler.

        K Offline
        K Offline
        KyleRoth
        wrote on 31 Mar 2022, 15:18 last edited by KyleRoth
        #3

        @jsulm That is what I'm having trouble with. I was able to install a working compiler on my laptop, and use it outside of Qt. When trying to switch Qt to this compiler, I ran into errors.
        How do i 'build' Qt with this compiler?
        I had tried going to options>kits>compilers. and adding a new compiler, linked to the one i had downloaded. Then, adding a new kit that used this other compiler. Is this not enough?

        J 1 Reply Last reply 1 Apr 2022, 06:51
        0
        • K KyleRoth
          31 Mar 2022, 15:18

          @jsulm That is what I'm having trouble with. I was able to install a working compiler on my laptop, and use it outside of Qt. When trying to switch Qt to this compiler, I ran into errors.
          How do i 'build' Qt with this compiler?
          I had tried going to options>kits>compilers. and adding a new compiler, linked to the one i had downloaded. Then, adding a new kit that used this other compiler. Is this not enough?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 1 Apr 2022, 06:51 last edited by
          #4

          @KyleRoth said in macOS using Homebrew 'c++' compiler:

          Is this not enough?

          No, because you need Qt built with that compiler to be able to create this Kit.

          Building Qt is not an easy job:

          • https://wiki.qt.io/Building_Qt_5_from_Git
          • https://doc.qt.io/qt-5/build-sources.html
          • https://doc.qt.io/qt-6/build-sources.html

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A Offline
            A Offline
            AndrewCQT
            wrote 20 days ago last edited by
            #5

            If you want to use a newer version of clang than Apples version then it is really very simple. For example you might do this to have access to OpenMP. Just install llvm with homebrew, then set your cmake CXX and C compiler to point to the homebrew version.

            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