QtCreator vs. Xcode



  • First of all:
    I am a complete newbie in Qt. I have developed an OpenGL-Project, which should now contain a nice GUI. Thats why I am trying to learn Qt.

    I have installed the Qt SDK. I have no problems at all to run the opengl-examples in QtCreator. Now I wanted to integrate Qt in Xcode. I have tried the same example. I have integrated all headers. In the code are no errors, but I get these messages, when push "Build and Run".

    @
    ld: warning: in /Developer/QtSDK/Simulator/Qt/gcc/lib/QtOpenGL.framework/QtOpenGL, file was built for unsupported file format which is not the architecture being linked (i386)
    Undefined symbols:
    "GLWidget::yRotationChanged(int)", referenced from:
    GLWidget::setYRotation(int) in glwidget.o
    "QString::free(QString::Data*)", referenced from:
    QString::~QString()in window.o
    "QWidget::~QWidget()", referenced from:
    Window::Window()in window.o
    Window::~Window()in main.o
    "QWidget::close()", referenced from:
    Window::keyPressEvent(QKeyEvent*) in window.o
    "QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType)", referenced from:
    Window::Window()in window.o
    "QWidget::setWindowTitle(QString const&)", referenced from:
    Window::Window()in window.o
    "QMetaObject::tr(char const*, char const*) const", referenced from:
    Window::tr(char const*, char const*)in window.o
    "QGLWidget::qglClearColor(QColor const&) const", referenced from:
    GLWidget::initializeGL() in glwidget.o
    "vtable for Window", referenced from:
    __ZTV6Window$non_lazy_ptr in window.o
    __ZTV6Window$non_lazy_ptr in main.o
    (maybe you meant: __ZTV6Window$non_lazy_ptr)
    "QHBoxLayout::QHBoxLayout()", referenced from:
    Window::Window()in window.o
    "QWidget::sizeHint() const", referenced from:
    _main in main.o
    "QColor::dark(int) const", referenced from:
    GLWidget::initializeGL() in glwidget.o
    "GLWidget::zRotationChanged(int)", referenced from:
    GLWidget::setZRotation(int) in glwidget.o
    "QAbstractSlider::setSingleStep(int)", referenced from:
    Window::createSlider() in window.o
    "QWidget::QWidget(QWidget*, QFlagsQt::WindowType)", referenced from:
    Window::Window()in window.o
    "vtable for GLWidget", referenced from:
    __ZTV8GLWidget$non_lazy_ptr in glwidget.o
    (maybe you meant: __ZTV8GLWidget$non_lazy_ptr)
    "qFlagLocation(char const*)", referenced from:
    Window::Window()in window.o
    "QWidget::resize(QSize const&)", referenced from:
    _main in main.o
    "QColor::operator=(QColor const&)", referenced from:
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QAbstractSlider::setValue(int)", referenced from:
    Window::Window()in window.o
    "QSlider::setTickPosition(QSlider::TickPosition)", referenced from:
    Window::createSlider() in window.o
    "QSlider::QSlider(Qt::Orientation, QWidget*)", referenced from:
    Window::createSlider() in window.o
    "QAbstractSlider::setRange(int, int)", referenced from:
    Window::createSlider() in window.o
    "QtLogo::setColor(QColor)", referenced from:
    GLWidget::initializeGL() in glwidget.o
    "QtLogo::QtLogo(QObject*, int, double)", referenced from:
    GLWidget::initializeGL() in glwidget.o
    "QApplication::desktop()", referenced from:
    _main in main.o
    "Window::staticMetaObject", referenced from:
    __ZN6Window16staticMetaObjectE$non_lazy_ptr in window.o
    (maybe you meant: __ZN6Window16staticMetaObjectE$non_lazy_ptr)
    "QColor::fromCmykF(double, double, double, double, double)", referenced from:
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QAbstractSlider::setPageStep(int)", referenced from:
    Window::createSlider() in window.o
    "QGLFormat::~QGLFormat()", referenced from:
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QWidget::showMaximized()", referenced from:
    _main in main.o
    "GLWidget::xRotationChanged(int)", referenced from:
    GLWidget::setXRotation(int) in glwidget.o
    "QApplication::QApplication(int&, char**, int)", referenced from:
    _main in main.o
    "QGLFormat::QGLFormat(QFlagsQGL::FormatOption, int)", referenced from:
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QSlider::setTickInterval(int)", referenced from:
    Window::createSlider() in window.o
    "QApplication::exec()", referenced from:
    _main in main.o
    "QWidget::setLayout(QLayout*)", referenced from:
    Window::Window()in window.o
    "QGLWidget::~QGLWidget()", referenced from:
    GLWidget::~GLWidget()in glwidget.o
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QWidget::keyPressEvent(QKeyEvent*)", referenced from:
    Window::keyPressEvent(QKeyEvent*) in window.o
    "QApplication::~QApplication()", referenced from:
    _main in main.o
    "QtLogo::draw() const", referenced from:
    GLWidget::paintGL() in glwidget.o
    "QColor::invalidate()", referenced from:
    QColor::QColor()in glwidget.o
    "QGLWidget::QGLWidget(QGLFormat const&, QWidget*, QGLWidget const*, QFlagsQt::WindowType)", referenced from:
    GLWidget::GLWidget(QWidget*)in glwidget.o
    "QWidget::show()", referenced from:
    _main in main.o
    "QBoxLayout::addWidget(QWidget*, int, QFlagsQt::AlignmentFlag)", referenced from:
    Window::Window()in window.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    @

    Now my questions:

    Is it possible that I get this message, because I am not using qmake.

    I have tried use qmake and pasted into the terminal the following line: qmake -spec macx-xcode project.pro

    but i only get the message qmake: command not found

    Is it adviseable to use QtCreator instead of Xcode? Is it possible to compile every opengl code with qt?



  • I never had used xCode but it seems that it is a lib path problem.
    Try to indicate to xCode the path to the Qt libraries



  • You will have to add at least QtCore and QtGui (and maybe some more) to the list of used frameworks in XCode.

    Regarding your qmake problem: You will have to call it by its full path. I don't know where it is located in the SDK. I'd try

    @
    mdfind -name qmake | grep bin
    @

    on the command line.



  • Thanks for your answers: Somehow this qmake isnt working. My qmake file can be found here: /Developer/QtSDK/Simulator/Qt/gcc/bin/qmake

    Then I have typed in: /Developer/QtSDK/Simulator/Qt/gcc/bin/qmake -project -o /Developer/QtSDK/Examples/4.7/opengl/untitled

    Nothing happens!

    My biggest question right now is how to create this .pro-file. Because its not working with me.

    Thanks in Advance



  • The argument to "-o" is the .pro file you want to create. It's unlikely that the path you provided is what you want :)

    So, go to a terminal and type:

    @
    cd /path/to/your/source
    /Developer/QtSDK/Simulator/Qt/gcc/bin/qmake -spec macx-xcode project.pro
    open project.xcodeproj
    @

    Regarding your 3rd question: yes that's possible and easy. Both XCode and Qt Creator just call gcc behind the scenes.

    [fixed strikethrouh error, Volker]



  • Thank you it worked....


Log in to reply
 

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