Any QT users out there - on a Mac?

This is a discussion on Any QT users out there - on a Mac? within the C++ Programming forums, part of the General Programming Boards category; I posted this on the QT forum. No takers over there yet. In a nutshell, it won't compile even a ...

  1. #1
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309

    Any QT users out there - on a Mac?

    I posted this on the QT forum. No takers over there yet.

    In a nutshell, it won't compile even a basic sample, neither inside Xcode (after following the instructions in the C++ QT GUI programming book) or with Make either. I'm baffled.

    Can't compile sample - Mac OS X 10.5, latest QT SDK download - Qt Centre Forum

    Thanks if you can help.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    you should summarize it here and post the pics here, because frankly, im not interested in spending the time it takes to register at a site I will never go back to.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Can't imagine this would be the problem, but I see you have a lowercase 'h' in "headers" here:
    Code:
    #include </Library/Frameworks/QtGui.framework/headers/QApplication>
    #include </Library/Frameworks/QtGui.framework/headers/QLabel>
    Your build line seems to have an uppercase 'H'.

    Also, I've hardly ever used Qt 4, but (on Linux at least) I could always just use #include <QApplication> directly. I expect you'll be able to as well, since the qmake-generated g++ line includes a -I pointing to the Qt 4 headers.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    I replaced the #includes with #includes with <QApplication> and <QLabel> and get the same error.
    "Headers" now comes out with a cap "H" but that's the only difference.

    Summarizing: (well, duplicating)

    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:
    Code:
    qmake -project
    and it creates qt_test2.pro. Now, I have 2 files in /qt_test2.

    Then, I run:
    Code:
    qmake -spec macx-xcode qt_test2.pro
    and the folder now contains:

    Code:
    rw-r--r-- ..1 toddburch ..toddburch ..600 Sep 28 21:33 Info.plist
    -rw-r--r-- ..1 toddburch ..toddburch ..293 May ..1 ..2008 qt_test2.cpp
    -rw-r--r-- ..1 toddburch ..toddburch ..594 Sep 28 21:32 qt_test2.pro
    drwxr-xr-x ..5 toddburch ..toddburch ..170 Sep 28 21:33 qt_test2.xcodeproj
    and the xcodeproj contains:
    Code:
    ~/Xcode/qt_test2/qt_test2.xcodeproj toddburch $ ls -l
    total 40
    -rw-r--r-- ..1 toddburch ..toddburch ..11269 Sep 28 21:33 project.pbxproj
    -rw-r--r-- ..1 toddburch ..toddburch .. 3488 Sep 28 21:33 qt_makeqmake.mak
    -rw-r--r-- ..1 toddburch ..toddburch .. 2549 Sep 28 21:33 qt_preprocess.mak
    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?

    (And if you can't read the attachments, blame it on the forums constraints for image size and dimensions)
    Attached Images Attached Images   
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  5. #5
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    And, here's the second half:

    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

    Code:
    ~/Xcode/qt1 toddburch $ qmake -spec macx-g++ qt1.pro 
    ~/Xcode/qt1 toddburch $ make
    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
    moc_qapplication.cpp: In member function ‘virtual int QApplication::qt_metacall(QMetaObject::Call, int, void**)’:
    moc_qapplication.cpp:110: error: invalid use of undefined type ‘struct QApplicationPrivate’
    /Library/Frameworks/QtCore.framework/Headers/qobject.h:295: error: forward declaration of ‘struct QApplicationPrivate’
    moc_qapplication.cpp:120: error: invalid use of undefined type ‘struct QIcon’
    /Library/Frameworks/QtGui.framework/Versions/4/Headers/qapplication.h:72: error: forward declaration of ‘struct QIcon’
    make: *** [moc_qapplication.o] Error 1
    ~/Xcode/qt1 toddburch $ ls -l
    Here's my source.

    Code:
    #include <QApplication>
    #include <QLabel> 
    ..
    int main (int argc, char * argv[]) {
    .. .. QApplication app(argc, argv) ; 
    .. .. QLabel * label = new QLabel("Hello Todd") ; 
    .. .. label->show() ; 
    .. .. return app.exec() ; 
    }
    User error? Install error? Qt error?
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Here is the full build from Xcode, with errors.
    Attached Files Attached Files
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Is there any chance you have a version mismatch between the Qt headers and the moc tool? Do you have multiple versions of Qt installed?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #8
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    I did have QT 4.3.3 installed and it would not work, but it only
    gave me 2 compile errors. So, I installed the latest download on
    top of the previous release. If the install isn't smart enough to
    figure that out, then that might be the issue. I'm travelling now
    so I won't be able to reinstall to test until this weekend. Thanks for the idea.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  9. #9
    Registered User
    Join Date
    Sep 2009
    Posts
    63
    You could try using Qt Creator, which they probably have for Mac OS X. If projects in that don't work, then something got screwed up during install or something.

  10. #10
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Yes, QTCreator comes with the install. I can try that b4 I reinstall.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mac OS X Users/C programmers?
    By petermichaux in forum C Programming
    Replies: 16
    Last Post: 04-18-2011, 07:36 AM
  2. How to Send Mac Address From Client to Server
    By Lieyza197 in forum C Programming
    Replies: 2
    Last Post: 05-27-2009, 10:58 AM
  3. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  4. Windows ntfs perms
    By wp_x in forum Tech Board
    Replies: 3
    Last Post: 03-04-2003, 06:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21