[SOLVED] Error "You need a C++ compiler..." when installing Qt SDK on Mac

  • I've been using Qt for quite a while on Windows. I just got a Mac and tried to install the Qt SDK on it, but got an error that said I need a C++ compiler, and to download XCode. So I downloaded XCode through the app store, installed it, and then tried to install the Qt SDK again, but got the same error.

    I then tried to install it anyways (there's an option to continue), but then I get errors about "Can't start the process install_name_tool"...

    I'm using OS X Lion with the latest updates installed.

    What should I do?

  • Moderators

    Install command line tools in addition to Xcode. I'm not an expert on mac, myself, but it might help. They are available (as a single package) on Apple's developer page.

  • Moderators

    Ah, I forgot - it's also possible, that you have to set your xcode folder with xcode-select. Best option: do both :)

  • I ran terminal, and set the path using:

    sudo xcode-select -switch /Applications/Developer

    and it was successful (I think). But I tried to install the Qt SDK again and got the same error! Any other ideas?

  • Moderators

    Are you able to compile other, non-Qt code?

  • Yep, I just opened XCode, created a C++ console project, and built Hello World successfully.

  • Moderators

    I mean compile in terminal. Xcode is probably setting up the environment in the background.

  • Yeah, Terminal doesn't work. I think I misunderstood your first reply. When you said "command line tools" I thought you were talking about Terminal, since I tried searching the Mac app store for command line tools and didn't find anything. But now I realize it's just an add-on. I'll try installing it.

  • Moderators

    Yeah, those tools are not in App Store, they have to be downloaded separately. Okay then, maybe this time it works.

  • That did the trick. Thanks, I really appreciate your help.

  • Moderators

    You're welcome :) Just to fulfill the bureaucracy, please add "[Solved]" to the beginning of the subject of this topic. I've already tagged it accordingly.

  • [quote author="wayfaerer" date="1335805077"] … I tried searching the Mac app store for command line tools and didn't find anything. But now I realize it's just an add-on. I'll try installing it.[/quote]

    I'm glad that solved solved the problem!
    Can you let me in on the secret of where to get these tools? I hope that I don't have to download Xcode again - that took nearly a day out here.

    Dumb question. See the very first reply!!!!!

  • Moderators

    In new Xcode releases (>= 4.3) cmd line tools can be installed through Xcode Preferences window (although getting the package from dev page is still OK and valid ;)).

  • Please help!

    I have done all the steps here, but I still get the same error.
    Does anyone can please help?!
    I have been stuck on a couple of days with it ...


  • Moderators

    Best way is of course to get a real OS like Linux or even Windows, if you feel masochistic.

    Sorry, couldn't stop myself, but I don't like Mac OS. Jokes aside now, and onto your question: I think we need a bit more data. What have you set xcode-select path to? Which version of Xcode are you using (and which MacOS)? Is the situation the same as for wayfaerer, that is - Xcode compilation works, but command line fails?

  • Yes, I think you are right. I might stick with Ubuntu to develop in C++.

    I am still fighting with MacOS because I have a lot of friends that love Xcode, so I am still giving a try. But eventually (very soon) I might abandon MacOS for that!! :)

    I am using Lion, and Xcode 4.4 with command line installed. I used the command:
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

    As I don't have experience with Xcode so I am not using it. I just wrote a little program using vi and complied using g++ and c++, through Terminal program.

    This command line should be used inside XCode?

    There is still hope for me? :0)

    Thanks a lot!

  • Moderators

    Hm, so standard compilation works, yet you still can't install the SDK? I'm out of ideas, apart from one workaround: install Qt libraries and QtCreator separately, without using the SDK.

  • Moderators

    Oh, and be sure to use 4.8.2, as makespecs for xcode are not working with 4.8.1.

  • Ok Gene! Thanks! I will follow your suggestion!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.