Results 1 to 7 of 7

Thread: Can't compile sample - Mac OS X 10.5, latest QT SDK download

  1. #1
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Can't compile sample - Mac OS X 10.5, latest QT SDK download

    Hi. This is my second shot at Qt. I tried a year ago and gave up. Similar errors as now. Hopefully, I can get it working this time.

    I've just downloaded the latest SDK. I'm running current Leopard. Xcode 3.1 is installed and I use it for Java, C and C++ development all the time.

    For the life of me, I cannot compile the sample on page 4 of the Qtbook (C++ GUI Programming with Qt4, 2nd Edition). ("Hello QT!)

    I've entered the program into a qt_test2.cpp file in a qt_test2 folder. (~/Xcode/qt_test2/qt_test2.cpp).

    I run qmake while in that folder:
    Qt Code:
    1. qmake -project
    To copy to clipboard, switch view to plain text mode 
    and it creates qt_test2.pro. Now, I have 2 files in /qt_test2.

    Then, I run:
    Qt Code:
    1. qmake -spec macx-xcode qt_test2.pro
    To copy to clipboard, switch view to plain text mode 
    and the folder now contains:

    Qt Code:
    1. rw-r--r-- 1 toddburch toddburch 600 Sep 28 21:33 Info.plist
    2. -rw-r--r-- 1 toddburch toddburch 293 May 1 2008 qt_test2.cpp
    3. -rw-r--r-- 1 toddburch toddburch 594 Sep 28 21:32 qt_test2.pro
    4. drwxr-xr-x 5 toddburch toddburch 170 Sep 28 21:33 qt_test2.xcodeproj
    To copy to clipboard, switch view to plain text mode 
    and the xcodeproj contains:
    Qt Code:
    1. ~/Xcode/qt_test2/qt_test2.xcodeproj toddburch $ ls -l
    2. total 40
    3. -rw-r--r-- 1 toddburch toddburch 11269 Sep 28 21:33 project.pbxproj
    4. -rw-r--r-- 1 toddburch toddburch 3488 Sep 28 21:33 qt_makeqmake.mak
    5. -rw-r--r-- 1 toddburch toddburch 2549 Sep 28 21:33 qt_preprocess.mak
    To copy to clipboard, switch view to plain text mode 

    Now, I've run qmake in "project mode" and then in "make mode". There's no .app,
    which I expect, as I want to compile using Xcode. In Xcode, I open the qt_test2.xcodeproj file. (Project Screenshot attached).

    I then click Build in Xcode and get lots of error in code that is not mine. Here's a summary in the other screenshot.

    What am I doing wrong? Thanks, Todd.
    Attached Images Attached Images

  2. #2
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    So, I don't want to use Makefiles, but I figured I would try it while waiting for an answer. Here's the result. No bueno. (Note I created a new folder and source file)

    Just before this Make attempt, I entered: qmake qt1.pro

    Qt Code:
    1. ~/Xcode/qt1 toddburch $ qmake -spec macx-g++ qt1.pro
    2. ~/Xcode/qt1 toddburch $ ls -l
    3. total 40
    4. -rw-r--r-- 1 toddburch toddburch 10328 Sep 28 22:58 Makefile
    5. -rw-r--r-- 1 toddburch toddburch 293 Sep 28 22:47 qt1.cpp
    6. -rw-r--r-- 1 toddburch toddburch 589 Sep 28 22:55 qt1.pro
    7. ~/Xcode/qt1 toddburch $ make
    8. g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.5/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I. -I. -F/Library/Frameworks -o qt1.o qt1.cpp
    9. /Developer/Tools/Qt/moc -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.5/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I. -I. -F/Library/Frameworks -D__APPLE__ -D__GNUC__ /Library/Frameworks/QtGui.framework/Versions/4/Headers/qapplication.h -o moc_qapplication.cpp
    10. g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.5/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I. -I. -F/Library/Frameworks -o moc_qapplication.o moc_qapplication.cpp
    11. moc_qapplication.cpp: In member function ‘virtual int QApplication::qt_metacall(QMetaObject::Call, int, void**)’:
    12. moc_qapplication.cpp:110: error: invalid use of undefined type ‘struct QApplicationPrivate’
    13. /Library/Frameworks/QtCore.framework/Headers/qobject.h:295: error: forward declaration of ‘struct QApplicationPrivate’
    14. moc_qapplication.cpp:120: error: invalid use of undefined type ‘struct QIcon’
    15. /Library/Frameworks/QtGui.framework/Versions/4/Headers/qapplication.h:72: error: forward declaration of ‘struct QIcon’
    16. make: *** [moc_qapplication.o] Error 1
    17. ~/Xcode/qt1 toddburch $
    To copy to clipboard, switch view to plain text mode 

    Here's my source.

    Qt Code:
    1. #include </Library/Frameworks/QtGui.framework/headers/QApplication>
    2. #include </Library/Frameworks/QtGui.framework/headers/QLabel>
    3.  
    4. int main (int argc, char * argv[]) {
    5. QApplication app(argc, argv) ;
    6. QLabel * label = new QLabel("Hello Todd") ;
    7. label->show() ;
    8. return app.exec() ;
    9. }
    To copy to clipboard, switch view to plain text mode 

    User error? Install error? Qt error?

    For as world class as Qt is made out to be, I'm not impressed yet.

  3. #3
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    If the graphic is difficult to read, attached is a copy and paste of the build errors from Xcode.
    The errors apears to be in the moc_qapplication, not my code.
    Attached Files Attached Files

  4. #4
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    Could this be an issue related to installing 4.5 on top of 4.3.3?

    I did not delete the previous version - I made an assumption that the install would be smart enough to do the right thing.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    Congratulations on one of the longest monologues I've seen in a forum

    Looks like it is not finding the headers. I'm not an OS X user, but I would assume that you do not need to spell out the full path to the headers; qmake and gcc take care of the path to find them. The stereotypical "Hello, World" looks like:
    Qt Code:
    1. #include <QApplication>
    2. #include <QLabel>
    3.  
    4. int main (int argc, char * argv[]) {
    5. QApplication app(argc, argv) ;
    6. QLabel * label = new QLabel("Hello Todd") ;
    7. label->show() ;
    8. return app.exec() ;
    9. }
    To copy to clipboard, switch view to plain text mode 
    Try that for starters.

    Qt Code:
    1. qmake -v
    To copy to clipboard, switch view to plain text mode 
    will tell what version of Qt it thinks it is using. The Makefile should be using the same version.

  6. #6
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    Thanks Chris.

    When not specifying the full path and just
    coding as you've shown, I get the same
    exact errors.

    I can check the version again to confirm
    when I get back in town. Thanks

  7. #7
    Join Date
    Sep 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Can't compile sample - Mac OS X 10.5, latest QT SDK download

    I uninstalled Qt and reinstalled. Same errors.

    Qt Code:
    1. ~/Xcode/qt_test2 toddburch $ qmake -v
    2. QMake version 2.01a
    3. Using Qt version 4.5.2 in /Library/Frameworks
    To copy to clipboard, switch view to plain text mode 

    What next? Please help. Thanks, Todd

Similar Threads

  1. Need sites to download sample projects
    By santhoshv84 in forum Qt Programming
    Replies: 3
    Last Post: 6th August 2008, 08:42
  2. qtgui4.dll error in visual c++ 2005
    By Comptrol in forum Installation and Deployment
    Replies: 33
    Last Post: 19th June 2008, 07:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.