Results 1 to 3 of 3

Thread: A program perfectly working on Win does not build on Mac

  1. #1
    Join Date
    May 2012
    Posts
    28
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default A program perfectly working on Win does not build on Mac

    I have a small program composed by two cpp modules, and a unique signal/slot connection.

    It compiles and runs perfectly in Win7 under Qt Creator 2.4.1/qt 4.8.1/MSVC2010.

    Instead, in a Max Os X, using QtCreator 2.4.1/qt 4.8.1/gcc, I get the following strange error messages.

    In issues:
    :-1: error: symbol(s) not found for architecture x86_64
    :-1: error: collect2: ld returned 1 exit status

    In compile output:
    ld: warning: directory not found for option '-L/usr/local/pgsql/lib'
    ld: warning: directory not found for option '-L/tmp/qt-stuff-85167/source/qt-everywhere-opensource-src-4.8.1/Desktop/Qt/4.8.1/gcc/lib'
    ld: warning: directory not found for option '-F/tmp/qt-stuff-85167/source/qt-everywhere-opensource-src-4.8.1/Desktop/Qt/4.8.1/gcc/lib'
    Undefined symbols for architecture x86_64:
    "vtable for CLineChart", referenced from:
    CLineChart::CLineChart(QWidget*)in clinechart.o
    CLineChart::CLineChart(QWidget*)in clinechart.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    "CLineChart::staticMetaObject", referenced from:
    CLineChart::tr(char const*, char const*)in clinechart.o
    "CLineChart::valuesChanged(SXYValues, bool, bool)", referenced from:
    CLineChart::mouseMoveEvent(QMouseEvent*) in clinechart.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make: *** [TestLineChart.app/Contents/MacOS/TestLineChart] Error 1
    make: Leaving directory `/Users/ceraolo/Documents/C++/TestLineChartAAA'
    11:09:15: The process "/usr/bin/make" exited with code 2.
    Error while building project TestLineChart (target: Desktop)
    When executing build step 'Make'


    I've verified that if I eliminate all slots and signals but leave the QT_OBJECT macro in the code the problem is still there.
    When I comment out the QT_OBJECT also the program compiles and links, but, obviously I lose important functionality.

    Any suggestions?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: A program perfectly working on Win does not build on Mac

    It's Q_OBJECT, not QT_OBJECT. Make distclean, qmake, make.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    mchome (19th July 2012)

  4. #3
    Join Date
    May 2012
    Posts
    28
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: A program perfectly working on Win does not build on Mac

    My message was wrong but the issue is related to the correct spelling Q_OBJECT.
    In fact, as I mentioned, with this keyword included, my program under Windows compiles, builds and runs perfectly.
    Under Mac causes that error message.

    MC

    My message was wrong but the issue is related to the correct spelling Q_OBJECT.
    In fact, as I mentioned, with this keyword included, my program under Windows compiles, builds and runs perfectly.
    Under Mac causes that error message.

    MC


    Added after 4 minutes:


    My message was wrong but the issue is related to the correct spelling Q_OBJECT.
    In fact, as I mentioned, with this keyword included, my program under Windows compiles, builds and runs perfectly.
    Under Mac causes that error message.

    Make distclean, qmake, make

    I will try tomorrow.


    Added after 40 minutes:


    I could not want until tomorrow.
    I tried the cleaning up you suggested and... voilà , it works!

    I've also understood what caused that mess.
    In the same computer I've Mac OS and Win7 systems. I don' have to reboot to switch between the two, since I use Parallels Desktop that makes windows 7 run in virtual machine.

    But I dared too much: I used to recompile the same source code with the two systems, without first copying it into a different folder. It resulted that the two compilation processes created files that were somewhat incompatible

    From now I will use a different technique.
    Normally I will work in Mac, with files in a folder dedicated to mac compilation. From time to time, to be sure about the program functionality and look and feel under Windows, I will copy the source files in a folder dedicated to Win compilation and compile under Windows.

    This way I should avoid to repeat the same mistake.

    Thank you for your suggestion.

    MC

    I could not want until tomorrow.
    I tried the cleaning up you suggested and... voilà , it works!

    I've also understood what caused that mess.
    In the same computer I've Mac OS and Win7 systems. I don' have to reboot to switch between the two, since I use Parallels Desktop that makes windows 7 run in virtual machine.

    But I dared too much: I used to recompile the same source code with the two systems, without first copying it into a different folder. It resulted that the two compilation processes created files that were somewhat incompatible

    From now I will use a different technique.
    Normally I will work in Mac, with files in a folder dedicated to mac compilation. From time to time, to be sure about the program functionality and look and feel under Windows, I will copy the source files in a folder dedicated to Win compilation and compile under Windows.

    This way I should avoid to repeat the same mistake.

    Thank you for your suggestion.

    MC
    Last edited by mchome; 19th July 2012 at 23:01.

Similar Threads

  1. After changing QT_QWS_FONTDIR , QT program not working?
    By lllturtle in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 9th November 2011, 07:03
  2. gdb stops working for Qt program ???
    By enno in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2011, 12:47
  3. Socket program not working
    By nighil in forum Qt Programming
    Replies: 4
    Last Post: 29th January 2011, 05:04
  4. why this program is not working
    By ramamurthy.kv in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2008, 13:26
  5. program for working with Data Base(i need it)
    By banakil in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 22:58

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.