G++-4.2: No such file or directory
-
I recently upgraded my MacOS X to Lion and then my XCode (which broke in the process) to 4.2.1 from the Mac App Store (I can't recall the version I used before). I haven't used Qt for a while on this computer but, trying to use today gave an error when building. I figured this needed a reinstall as well, so I made a completely new installation of Qt Desktop 4.7.4.
I still get the following error in the issues pane when trying to build/run:
g++-4.2: No such file or directory
I'm sure something is just not set up correctly, but I have no idea where to look. I don't know if this is one of those command line things or if I can fix this using Qt Creator's settings.
I'm very much noob when it comes to understanding how all those scattered files (make, qmake, gcc, g++ all that stuff) gets used by Qt Creator, so don't worry about stating the obvious, I won't be offended!
Thanks in advance for any help.
-
I'm not 100% sure, but AFAIK there have been some problems regarding XCode 4. I'm don't know if and when that has been sorted out.
-
The problem is that g++-4.2 comes with the MacOs 10.6 SDK and is usually installed in /usr/bin. The default qmake spec is macx-g++42, and that points to this compiler. If the 10.6 SDK is not installed, that fails.
The workaround on Mac Os 10.7 is to switch to the clang toolchain for now. -
Thank you miroslav. I will try to do this. Do you know of any resources that describe the process?
For the record, I have now duplicated the problem on the following configurations:
MacOS 10.7.2 (Lion), XCode 4.2.1
MacOS 10.6.8 (Snow Leopard), XCode 4.2Eon
-
... or you can force the mkspec used by passing a "-spec macx-g++" to the qmake step (which will override the one chosen by Qt Creator).
... or you can create a symlink from /usr/bin/g++ and /usr/bin/gcc to /usr/bin/g++-4.2 and /usr/bin/gcc-4.2
... or you could test http://codereview.qt-project.org/#change,11297 and tell me whether that fixes the issue.
I would highly appreciate somebody trying the latter;-)
-
I think the underlying issue is the Creator defaults to the macx-g++42 make spec. So Tobias' suggestion to override that with macx-g++ is probably the best solution for now. The only resources that I know of are here in the forum.
-
Thanks guys. I tried, but I honestly do not know how to do what you suggest. To "override that with macx-g++". Qt Creator's preferences doesn't seem to show anything like that so I'm guessing what you're suggesting requires more advance command line stuff.
I tried Tobias' link, but a login is required for that (the one for this forum doesn't work for me).
I can develop on my Windows machine for now.
-
Also "check here":http://developer.qt.nokia.com/forums/viewthread/12592/: Another thread about this topic, with a better explanation on how to override the mkspec.
-
Just submitted a review here, this seems to solve the problem: http://codereview.qt-project.org/#change,11297
-
... and I just submitted the fix to the 2.4 branch. Thanks Miroslav for testing!
-
My pleasure :-)
-
To solve the problem:
When upgrading from 10.6 to 10.7, you can not uninstall Xcode to upgrade just because the g + + -4.2 to install xcode 4.2.
The steps are:
1 - keep the xcode 3.2, I'm not wrong.
install xcode 4.2 and above.PS: If you uninstall the xcode 3.2 and xcode 4.2 install to make any kind of build in QT, you'll get errors (g + + -4.2 no such directory) or something like that.
2 - After upgrading to the Lion remains with the xcode 3.2, install the xcode 4.2 and 3.2 does not uninstall after install QT.
-
So I'm having the same issue, has this been resolved yet? I'm also running Mac OSX 10.7.2 with XCode 4.2.1
I tried following this link: http://codereview.qt-project.org/#change,11297 But it requires a username and password. Any help without having to do a clean install would be much appreciated,
-
I just add macx-g++ and error disappeared, but then make or g++ doesn't see all Qt classes, macros and etc.... Building from Qt creator, Mac Os 10.7, XCode 4.2
Any advice ?
-
here with the spec macx-g++ that's not work!
-
Hi!
[quote author="alpha_one_x86" date="1331383665"]here with the spec macx-g++ that's not work![/quote]
Could you give a few more details on what exactly is not working?
-
I have drop the MAC SDK version, because Qt 4.8 not work with xcode3, and with xcode4 SDK version is minimum 10.6