Results 1 to 3 of 3

Thread: Qt 4.6.x on MacOS X Snow Leo - compiling with g++ in Terminal window?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Qt 4.6.x on MacOS X Snow Leo - compiling with g++ in Terminal window?

    Shouldn't this work?

    I tried both installing QtCreator SDK and Qt4-mac from Macports. In the QtCreator preferences it says Qt was found in my PATH variable. I also export the path to my Qt-libs in my .profile file (export PATH=/lib:/bin:/sbin:/usr/lib:/usr/bin:/usr/sbin:/usr/local/lib:/usr/local/bin:/usr/local/Qt4.6:$PATH).

    Compiling with QtCreator works (with XCode too). But i really like to write small projects just with TextMate and compile them with my gcc in a terminal window. When i try to import <QtGui> oder "QtGui.h" i always get "no such file or directory"-errors.

    What do i do wrong?

    (i guess this totally newbie question was asked a hundred times, but i couldn't find an answer)
    Last edited by cargath; 16th May 2010 at 16:59.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qt 4.6.x on MacOS X Snow Leo - compiling with g++ in Terminal window?

    How do you create your Makefile?
    Qt Code:
    1. /usr/bin/qmake -spec /usr/local/Qt4.6/mkspecs/macx-g++ -macx CONFIG+=release -o Makefile foo.pro
    To copy to clipboard, switch view to plain text mode 
    works fine for me.

  3. #3
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt 4.6.x on MacOS X Snow Leo - compiling with g++ in Terminal window?

    Well, since i don't use QtCreator i don't have a .pro file. I do it the old fashioned way - by hand.
    Didn't knew i had to import some headers and frameworks via -I / -F / -L into my compiler. It's the first time i use an external framework within my code. The Qt-FAQ stated it would be enough to have it in my $PATH to use it

    I've still one little question, and since i already opened this thread...
    What exactly does "Q_OBJECT" do in the beginning of a class-definition? I always see this in examples from the qt-homepage. If write this in the beginning if my GLCanvas class which is derived from QGLWidget i get:

    Undefined symbols:
    "vtable for GLCanvas", referenced from:
    __ZTV8GLCanvas$non_lazy_ptr in ccTZCYSb.o
    (maybe you meant: __ZTV8GLCanvas$non_lazy_ptr)

Similar Threads

  1. Replies: 0
    Last Post: 28th April 2010, 02:22
  2. cross-compiling a Qt app for MacOS X?
    By akos.maroy in forum Qt Programming
    Replies: 0
    Last Post: 3rd August 2009, 20:37
  3. Christmas snow with Qt?
    By whitefurrows in forum Qt Programming
    Replies: 10
    Last Post: 28th November 2008, 14:57
  4. help about terminal window
    By andyyeng in forum Qt Programming
    Replies: 0
    Last Post: 29th October 2008, 15:22
  5. Strange dependencies when compiling on MacOS
    By pir in forum Installation and Deployment
    Replies: 0
    Last Post: 14th November 2006, 13:49

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
  •  
Qt is a trademark of The Qt Company.