How to create a correct project with xcode 3.1.3



  • Hello I successfully manage to build my app with visual studio 2008 and also for linux32 and linux64 however I am having a very difficult time make the Mac project
    for some reason regardless of what I do I get tons of errors.
    I tried different types of projects and the one that generates the least errors is the simple command line tool.
    here is a small sample of one error.

    @
    Building target “newtonDemo” of project “newtonDemo” with configuration “Debug” — (14 errors)
    cd /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5
    /Xcode3.1.3/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1 -isysroot /Xcode3.1.3/SDKs/MacOSX10.5.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/build/Debug -I/Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/build/Debug/include -I../../../sdkDemos/toolBox -I../../../../../packages/dMath -I../../../../../packages/dScene -I../../../../../packages/dContainers -I../../../../../packages/thirdParty/tinyxml -I../../../../../coreLibrary_200/source/newton -I/Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/build/newtonDemo.build/Debug/newtonDemo.build/DerivedSources/i386 -I/Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/build/newtonDemo.build/Debug/newtonDemo.build/DerivedSources -c /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/../../../sdkDemos/DemoCamera.cpp -o /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/build/newtonDemo.build/Debug/newtonDemo.build/Objects-normal/i386/DemoCamera.o
    In file included from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/string:44,
    from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qstring.h:60,
    from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qobject.h:48,
    from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45,
    from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Headers/qapplication.h:45,
    from /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks/QtGui.framework/Headers/QApplication:1,
    from ../../../sdkDemos/toolBox/toolbox_stdafx.h:93,
    from /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5/../../../sdkDemos/DemoCamera.cpp:17:
    /Xcode3.1.3/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h:79: error: current namespace 'std' does not enclose strongly used namespace '__gnu_debug_def'
    /Xcode3.1.3/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h:79: error: current namespace 'std' does not enclose strongly used namespace '__gnu_debug_def'
    @

    I also try opening any of the demos from the example folder in the Qt installation and they all generate lot of errors.
    what I am doing wrong please.

    [EDIT: fixed output formatting, Volker]



  • The best way for the command line is a regular makefile project, not an XCode project. See this "wiki article":http://developer.qt.nokia.com/wiki/Generate_Makefiles_instead_of_XCode_projects_on_Mac_OS_X for how to do this.



  • So there is not way to use xcode with qt?

    Xcode is used in 10 or tousands of world class applications, what is that all about?
    only the paleo nerds of the 70's and 80's still use makefile.



  • You can also create an XCode project if you want. I think it is not used by many programmers, so you'll have to check and setup things yourself (moc and ui steps for the QObject based classes and the UI forms comes into mind) or you have to recreate the project every time you change your setup (and loose the hand tuned settings).



  • I want to use xcode, what I am doing wrong?
    I made a plane project that only has

    int main ()
    {
    return 1;
    }
    and the moment I include a qt header and the core Framework I get the same errors.

    I am not using moc or ui util. I have them builded already in the PC under Visual studio which has a nice interface to add Rules.
    so basically this is a plain project with .cpp and .h files and nothing else.
    This works perfectly fine fine in Linux.



  • I am trying the qmake and when I type:

    julio-jerezs-mac-bq. pro:OS10.6-xcode3.2.5 juliojerez$ qmake -project

    I do not see what it does, it does not says anything at all.
    the book says it is suppose to create a file helloWorld.pro
    is that wrong too?
    what is support to do?
    where is information for these qmake nonsence?



  • I am going out of my mind here, I cannot figure out how qmake works, I made a .pro file like this

    bq. TEMPLATE = app
    CONFIG -= moc
    DEPENDPATH += .
    INCLUDEPATH += .
    SOURCES += main.cpp

    then I run this command:

    qmake -spec mac-xcode project.pro

    but all I get is this errors.

    bq. julio-jerezs-mac-pro:OS10.6-xcode3.2.5 juliojerez$ qmake -spec mac-xcode project.pro
    Could not find mkspecs for your QMAKESPEC(mac-xcode) after trying:
    /usr/local/Qt4.7/mkspecs
    Error processing project file: project.pro
    julio-jerezs-mac-pro:OS10.6-xcode3.2.5 juliojerez$

    please what I am doing so wrong?



  • Now when I click on the projrct.pro file it automatically open QTCreator

    bu ther when I try tp build the projetc I get this criptic message than mean zero to me.
    bq. Could not find make command: make in the build environment
    Error while building project project (target: Desktop)
    When executing build step 'Make'

    does Qt works at all on Mac osx?
    or am I wasting my time?



  • well I pasted the error code in google, and I found that there thousands of people having the same problem.

    It appears that GCC 4.2 does not work with the version of SDT the xcode uses.
    this is the error in case anyone want to follow:

    error: current namespace 'std' does not enclose strongly used namespace '__gnu_debug_def'

    I switch to GCC 4.0 in xcode and now the compile pass that point, I get other errors but I believe those are on my side.
    If this is true wonder how such blonder can pass in a company like Apple.

    anyway I hope this is my last problem with this
    Thank you



  • The correct call for qmake to generate an XCode project file is

    @
    qmake -spec macx-xcode project.pro
    @

    notice it's macx not, mac before the -xcode.



  • Yes thank I saw that, I end up using QT creator to create a sample project and I add the a qmake target, with those parameters

    qmake -spec macx-xcode project.pro

    I created the xcode project and I got the same errors again,
    it is not until I select GCC 4.0 in xcode that everything works fine

    anyway I have my project compiling and linking now,
    that was my major problem, I do not have to be a complete expert I only need to provide working demo, Qt is an excellent tool for that.
    I have spent years learning different GUI, with very bad result.

    The only one I found that is bug free is MFC, but it has the bug problem of portability.
    I always was scare of Qt because of the size and because licensing conflict with my products.

    But since I decide to open source my product I took a look at Qt and to my delight this is by far the best GUI library I ever used. Clean Interface, well documented, and easy to used, excellent look across platform and so far for me it supports all eh feature I need.
    I know I had being asking lot of questions, but that because of eh size of the API, but I am very, very satisfied with Qt.

    Thank you for all the help you’d provided.



  • well now I am having linking problems
    but I do no know why is this

    these are some of them

    @ cd /Users/juliojerez/Desktop/newton-dynamics/applications/newtonDemos/projects/mac/OS10.6-xcode3.2.5
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    ld warning: in /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks//QtCore.framework/QtCore, missing required architecture ppc in file
    ld warning: in /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks//QtGui.framework/QtGui, missing required architecture ppc in file
    ld warning: in /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks//QtOpenGL.framework/QtOpenGL, missing required architecture ppc in file
    ld warning: in /Users/juliojerez/Desktop/newton-dynamics/packages/projects/mac/dScene/build/Debug/libdScene_d.a, file is not of required architecture
    ld warning: in /Users/juliojerez/Desktop/newton-dynamics/packages/projects/mac/dMath/build/Debug/libdMath_d.a, file is not of required architecture
    ld warning: in /Users/juliojerez/Desktop/newton-dynamics/packages/projects/mac/tinyxml/build/Debug/libtinyxml_d.a, file is not of required architecture
    ld warning: in /Users/juliojerez/Desktop/newton-dynamics/packages/projects/mac/dContainers/build/Debug/libdContainers_d.a, file is not of required architecture
    Undefined symbols:
    "QFileDialog::getOpenFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlagsQFileDialog::Option)", referenced from:
    newtonDemos::OnLoad() in NewtonDemos.o
    "QDialog::keyPressEvent(QKeyEvent*)", referenced from:
    vtable for SelectThreadCountin NewtonDemos.o
    "QAbstractSlider::setMaximum(int)", referenced from:
    SelectThreadCount::SelectThreadCount(DemoEntityManager*)in NewtonDemos.o
    "QWidget::mouseReleaseEvent(QMouseEvent*)", referenced from:
    vtable for DemoEntityManagerin DemoEntityManager.o
    vtable for newtonDemosin moc_NewtonDemos.o
    vtable for SelectThreadCountin NewtonDemos.o
    "QObject::qt_metacast(char const*)", referenced from:
    vtable for newtonDemosEventFilterin NewtonDemos.o
    "QWidget::focusOutEvent(QFocusEvent*)", referenced from:
    vtable for DemoEntityManagerin DemoEntityManager.o
    vtable for newtonDemosin moc_NewtonDemos.o
    vtable for SelectThreadCountin NewtonDemos.o
    "dBaseHierarchy::GetNext() const", referenced from:
    SimpleMeshLevel(DemoEntityManager*, bool) in MeshCollision.o
    "QObject::connectNotify(char const*)", referenced from:
    vtable for DemoEntityManagerin DemoEntityManager.o
    vtable for newtonDemosin moc_NewtonDemos.o
    vtable for newtonDemosEventFilterin NewtonDemos.o
    vtable for SelectThreadCountin NewtonDemos.o
    vtable for newtonDemosEventFilterin NewtonDemos.o
    @

    but I added the qt framework to the project.
    what is strange is that I believe I build once but them I save it and clean up the project and now it fail.

    do you know what could this be now?



  • Oh I see it looks like Qt does not work with G5 powerpc
    only on Intel.



  • Wrong. Qt support ppc and x86 both with 64 and 32 bit. See the "Developing Qt Applications for Mac OS X":http://doc.qt.nokia.com/4.7/developing-on-mac.html for the details which works on Carbon and which on Cocoa.

    Be aware, that you must tell the compiler to produce fat binaries. You can include this permanently into your .pro file, the page mentioned shows you how.



  • But I do have Universal binaries 64 set, the error says that the the Qt Frameworks do not have the PPC,

    MacOSX10.5.sdk/Library/Frameworks//QtCore.framework/QtCore, missing required architecture ppc in file ld warning: in /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks//QtGui.framework/QtGui, missing required architecture ppc in file ld warning: in /Xcode3.1.3/SDKs/MacOSX10.5.sdk/Library/Frameworks//QtOpenGL.framework/QtOpenGL, missing required architecture ppc in file

    It also says the same about my own libraries, which does not makes sence to me since I use them before, Oh man I had never had so much problem with xcode before.

    But anyway I do not think tshi has anything to do with Qt.

    Thank you



  • Then you have the Cocoa version of Qt. As the table on the page I posted clearly indicates, Cocoa + 64 bit PPC is not possible. If you need that, you must stick to Carbon.

    And this all has nothing to do with XCode. It's irrelevant if you compile on the command line, with Qt Creator or XCode, it's all the same regarding this aspect.


Log in to reply
 

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