Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

[SOLVED] qtCreator doesn't build my project since I update to Mountain Lion


  • Moderators

    G++ might have been removed in favor of clang/clang++, or for g++-4.x or something similar. Sorry, I don't have a mac available here so I can't check.



  • In /usr/bin i can't find any file that contain "g++", "clang" or "gcc" in the name.
    I think the problem will be resolved only with re-installing xcode...

    I'm download it and in a few minutes i will do it... ;)



  • Ok... I failed again...
    I found out the g++ and gcc comand in /Developer/usr/bin/ and i set they as manual in tool chains.
    I set "Compiler path" as /Developer/usr/bin/g++ and "Debugger" as /Developer/usr/bin/g++ too... Is it correct?


  • Moderators

    No, the debugger is called gdb. It will most likely be in the same directory as g++.



  • And then is somethig like this?
    Compiler path: /Developer/usr/bin/g++
    Debugger: /Developer/usr/bin/gdb

    right?



  • I done it and now qtCreator can find the compiler.

    But now I have an other problem... The compiler can't find the "basics" libraries like <iostream> or <string>.

    I don't know what i can do...

    This is the compile output log:

    08:36:40: Running build steps for project CalcolatriceSensibile...
    08:36:40: Configuration unchanged, skipping qmake step.
    08:36:40: Starting: "/Developer/usr/bin/make" -w
    make: Entering directory /Users/TresMac/Developing Project/C++/CalcolatriceSensibile-build-desktop-Desktop_Qt_4_7_4_for_GCC__Qt_SDK__Debug' g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -I../../../QtSDK/Desktop/Qt/474/gcc/mkspecs/macx-g++ -I../CalcolatriceSensibile -I../../../QtSDK/Desktop/Qt/474/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/474/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/474/gcc/lib/QtGui.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/474/gcc/include/QtGui -I../../../QtSDK/Desktop/Qt/474/gcc/include -I. -I. -I../CalcolatriceSensibile -I. -F/Users/TresMac/QtSDK/Desktop/Qt/474/gcc/lib -o mainTest.o ../CalcolatriceSensibile/mainTest.cpp In file included from ../CalcolatriceSensibile/logic/point.h:5, from ../CalcolatriceSensibile/mainTest.cpp:2: ../CalcolatriceSensibile/logic/function.h:4:17: error: string: No such file or directory In file included from ../CalcolatriceSensibile/mainTest.cpp:5: ../CalcolatriceSensibile/logic/utilities.h:7:18: error: sstream: No such file or directory ../CalcolatriceSensibile/mainTest.cpp:8:19: error: iostream: No such file or directory In file included from ../CalcolatriceSensibile/logic/point.h:5, from ../CalcolatriceSensibile/mainTest.cpp:2: ../CalcolatriceSensibile/logic/function.h:16: error: 'string' in namespace 'std' does not name a type In file included from ../CalcolatriceSensibile/mainTest.cpp:2: ../CalcolatriceSensibile/logic/point.h:19: error: 'string' in namespace 'std' does not name a type In file included from ../CalcolatriceSensibile/logic/line.h:6, from ../CalcolatriceSensibile/mainTest.cpp:3: ../CalcolatriceSensibile/logic/triangle.h:16: error: 'string' in namespace 'std' does not name a type In file included from ../CalcolatriceSensibile/mainTest.cpp:5: ../CalcolatriceSensibile/logic/utilities.h:17: error: expected constructor, destructor, or type conversion before 'toString' ../CalcolatriceSensibile/mainTest.cpp:10: error: 'std::cout' has not been declared ../CalcolatriceSensibile/mainTest.cpp: In function 'int main()': ../CalcolatriceSensibile/mainTest.cpp:15: error: 'cout' was not declared in this scope ../CalcolatriceSensibile/mainTest.cpp:16: error: 'class function' has no member named 'getExpression' ../CalcolatriceSensibile/mainTest.cpp:26: error: 'endl' is not a member of 'std' make: *** [mainTest.o] Error 1 make: Leaving directory/Users/TresMac/Developing Project/C++/CalcolatriceSensibile-build-desktop-Desktop_Qt_4_7_4_for_GCC__Qt_SDK__Debug'
    08:36:40: The process "/Developer/usr/bin/make" exited with code 2.
    Error while building project CalcolatriceSensibile (target: Desktop)
    When executing build step 'Make'



  • DISCLAIMER: use at your own risk and don't blame me if this procedure deletes precious files from your machine etc! :-)

    Let me tell you what I did when updating from Snow Leopard to Mountain Lion:

    1. Uninstalled Qt SDK using the respective option at SDK's updater.

    2. Installed the latest XCode from Mac App Store.

    3. From XCode, from the menu XCode --> Preferences --> Downloads, I downloaded Command Line Tools.

    4. I reinstalled Qt SDK.



  • I decided to do what you suggested... but i start from download last version of Xcode and then download the command line tools...

    Then I deleted the QtSDK and I'm gonna to re-install it...



  • The situation start to be very stressful... -_-
    I reinstalled QtCreator, and now QtCreator can see all the compiler.

    But...
    when I open my project and compile it the compiler return me the follow errors...

    ../CalcolatriceSensibile/mainTest.cpp: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
    ../CalcolatriceSensibile/mainTest.cpp:16: instantiated from here
    ../CalcolatriceSensibile/mainTest.cpp:16: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
    ../CalcolatriceSensibile/mainTest.cpp: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
    ../CalcolatriceSensibile/mainTest.cpp:16: instantiated from here
    ../CalcolatriceSensibile/mainTest.cpp:16: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
    ../CalcolatriceSensibile/mainTest.cpp: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
    ../CalcolatriceSensibile/mainTest.cpp:16: instantiated from here
    ../CalcolatriceSensibile/mainTest.cpp:16: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
    make: *** [mainTest.o] Error 1

    I can't understand why this error...



  • In particular the compiler give this error three times at the same row's code...

    /Users/TresMac/Developing Project/C++/CalcolatriceSensibile-build-desktop-Desktop_Qt_4_7_4_for_GCC__Qt_SDK__Debug/../CalcolatriceSensibile/mainTest.cpp:16: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available



  • I found that tis problem come out when i use the operator << with cout on a std:.string variable.

    For exemple this code give mi problems:
    @#include<string>
    #include<iostream>
    std::string exemple = "exemple";
    std::cout<<exemple;@



  • I have the same operator << problem. Does Anyone know how to solve it?



  • Yes!!

    I had the same problem with the
    "explicit instantiation of 'std:basic_ostream<..'"

    I tried out the flags that Qt used to compile a simple main routine. Seems it works if you say
    -mmacosx-version-min=10.7
    instead of
    -mmacosx-version-min=10.5

    There are no sdks for 10.5 or 10.6 on Mountain Lion and XCode 4.4!

    Hope that helped.

    cheers,

    tim


  • btw, the entries with

    -mmacosx-version-min=10.5

    can be found in

    $QTDIR/mkspecs/common/g++-macx.conf

    .

    cheers again...



  • Great! I just found that conf. It works now. Thanks a lot. :)



  • Perfect!! Now it works!!
    Thanks a lot!



  • Changing the mkspec file to -mmacosx-version-min=10.5 worked for me.

    This one was real obscure. Does anyone have reason why this would break std iostream functions? At first I thought it was change in the gcc version with Mountain Lion.

    Also, this appears to only effect gcc. Clang doesn't seem to have a problem with min-version is seto to 10.5


  • Moderators

    Did you guys "file a bug report":http://bugreports.qt-project.org/ ? This needs fixing in Qt.



  • This is nice, but on my MacBookPro with ML (and a brand new XCode) I still get an error like

    11:09:29: Configuration unchanged, skipping qmake step.
    11:09:29: Could not start process "make" -w
    Error while building project ImportMML (target: Desktop)
    When executing build step 'Make'

    What do you recommend ? Thanks ? jm



  • JMLA, In the latest xcode the command line tools aren't installed by default. Look in Xcode->preferences->downloads. Select "Command Line Tools". Once you do this you may need to re-open QtCreator. But if this is the problem I would have expected Qt to complain earlier about not finding the tool chain.



  • Thanks gosuperninja! It probably helps. Nevertheless the error code is now as below
    (I turned back to one of the QT basic drawing examples, that has always been working!)
    I am afraid I might be forced, to continue my work, to go for a while through Parallels... (:-(
    (I have added on Qt Creator/Preferences.../Build & Run/Manual GCC with correct paths)

    17:52:58: Running build steps for project basicdrawing...
    17:52:58: Starting: "/usr/bin/make" clean -w
    make: Entering directory /Users/JML/QtSDK/Examples/4.7/painting/basicdrawing' rm -f moc_renderarea.cpp moc_window.cpp rm -f qrc_basicdrawing.cpp rm -f main.o renderarea.o window.o moc_renderarea.o moc_window.o qrc_basicdrawing.o rm -f *~ core *.core make: Leaving directory/Users/JML/QtSDK/Examples/4.7/painting/basicdrawing'
    17:52:58: The process "/usr/bin/make" exited normally.
    17:52:58: Running build steps for project ImportMML...
    17:52:58: Starting: "/usr/bin/make" clean -w
    make: Entering directory /Users/JML/Desktop/Import_MML/ImportMML' rm -f moc_mainwindow.cpp rm -f ui_mainwindow.h rm -f main.o mainwindow.o qtmmlwidget.o moc_mainwindow.o rm -f *~ core *.core make: Leaving directory/Users/JML/Desktop/Import_MML/ImportMML'
    17:52:58: The process "/usr/bin/make" exited normally.
    17:52:58: Running build steps for project basicdrawing...
    17:52:58: Configuration unchanged, skipping qmake step.
    17:52:58: Starting: "/usr/bin/make" -w
    make: Entering directory /Users/JML/QtSDK/Examples/4.7/painting/basicdrawing' g++-4.2 -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.7 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../Desktop/Qt/4.8.1/gcc/mkspecs/macx-g++42 -I. -I../../../../Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../../Desktop/Qt/4.8.1/gcc/include/QtCore -I../../../../Desktop/Qt/4.8.1/gcc/lib/QtGui.framework/Versions/4/Headers -I../../../../Desktop/Qt/4.8.1/gcc/include/QtGui -I../../../../Desktop/Qt/4.8.1/gcc/include -I. -F/Users/JML/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o main.o main.cpp make: g++-4.2: No such file or directory make: *** [main.o] Error 1 make: Leaving directory/Users/JML/QtSDK/Examples/4.7/painting/basicdrawing'
    17:52:58: The process "/usr/bin/make" exited with code 2.
    Error while building project basicdrawing (target: Desktop)
    When executing build step 'Make'



  • JMLA, That issue isn't related to Mountain Lion. I had that one a bit ago. It has to do with QtCreator, there was a bug submitted about it. I'm using Qt Creator 4.5, it appears to be fixed. Maybe you're using 4.4? In any case it's a problem with the mkspec file that QtCreator picks, macx-g++42. It should be macx-g++. In the project settings override the spec and it should get past that issue. Hopefully thats your last problem :)



  • FYI, I created a bug for the mmacosx-version-min=10.5 issue, https://bugreports.qt-project.org/browse/QTBUG-26734



  • If you still want to compile and target 10.5 you need to install the 10.5 SDK. Alas it is not included with Xcode 4.4. It's a bit hacky, but the following works...

    Grab the xcode_3.2.6_and_ios_sdk_4.3.dmg from the developer.apple.com downloads area, and then:
    @
    open xcode_3.2.6_and_ios_sdk_4.3.dmg
    cd /Volumes/Xcode\ and\ iOS\ SDK/Packages
    open MacOSX10.5.pkg
    @

    Make sure to select the appropriate install directory (i.e. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer). You can substitute 'open MacOSX10.5.pkg' for 10.5 support.

    After installing the old SDK you'll need to add some symlinks:
    @
    cd "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/"
    ln -s i686-apple-darwin9 i686-apple-darwin11
    ln -s x86_64-apple-darwin9 x86_64-apple-darwin11
    @

    This worked for me. A similar hack can be used to get the 10.6 SDK, although you may want to grab that out of a later version of xCode... Best of luck!

    Thanks and Enjoy,
    Erik



  • Usually you wouldn't need to use the 10.5 SDK to target 10.5, actually that is what the -mmacosx-version-min=10.5 flag is supposed to do: Put the SDK that you use into a mode that is "compatible" with 10.5. I.e. you are supposed to be able to use the 10.7 SDK but still target 10.5 with that flag.

    So I wonder why the 10.8 SDK fails in that regard. Probably either a bug, or even more probable Apple just dropped support for developing for 10.5 (which wouldn't surprise me).



  • I have just installed Qt Creator in my Mac OS X Mountain Lion. I want to use it with OpenCV 2.4.2, but that is the next step.

    I know how to do stuff in Windows, but for some reason I can't get it to work in Mac OS X. At first I got a load of weird errors in the OpenCV files, but now I have limited them to the lines with cout in them.
    I have created a test project with just a std::cout << "test" << std::endl; call in it and it won't compile, saying cout is not a member of std.

    I have tried altering the file g++-macx.conf, inserting -mmacosx-version-min=10.7 and *10.8 where it originally said *10.5, but it didn't help.

    What I have done:
    I have installed XCode and through XCode I have installed the command line clients. I can find the gcc and g++ compilers in /usr/bin, so I reckon these are in place.

    What can I try next? I don't have any other clues now. Any help is greatly appreciated.



  • Well, that was worth a facepalm ... I completely overlooked the fact that I should've used "#include <iostream>" before I can use std::cout.

    But ... this still leaves the issues in the opencv includes, in the flann/params.h file to be exact. The exception I'm getting (after just adding "#include <cv.hpp>") are these:

    /usr/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available

    This was the reason why I assumed the cout was the problem. Trying that in my own code and having another error made me jump to conclusions a bit too quickly ...

    Can anyone help me with this problem for using OpenCV in Qt Creator on Mac OS Mountain Lion?



  • @mjepson: OpenCV doesn't use qmake as their build system, so changing Qt mkspecs doesn't change anything for OpenCV. I don't know how one would change the flags with cmake (which OpenCV uses), nor where to do it within OpenCVs build setup. Probably better ask on OpenCV forums/mailing lists.



  • Thanks for this great hack! However, it works only for macx-gcc and doesn't solve the problem when compiling with macx-llvm. Is there any hack known to resolve this issue?

    Cheeers!

    [quote author="garrgravarr" date="1343565804"]btw, the entries with

    -mmacosx-version-min=10.5

    can be found in

    $QTDIR/mkspecs/common/g++-macx.conf

    .

    cheers again...
    [/quote]



  • you can also use

    @unix:-g++: QMAKE_CXXFLAGS += -fpermissive@

    in your pro file to circumvent the problem



  • I was missing the command line tools which by they way can be downloaded from apple website also


Log in to reply