Qt World Summit: Submit your Presentation

Qt4/Cygwin link errors building from Hello.cpp

  • I am trying for the first time to build a Qt program using Qt4 from the Cygwin distribution. The recipe I'm following is the Hello program on the Wikipedia page for Qt.

    To install Qt, I selected the available Qt4 components in the Cygwin installer. I am appending the output of cygcheck -c which shows the packages that are active in my Cygwin installation. Due to a 6,000 character limit posting here, I am only able to offer filtered output, which is probably less than helpful.

    The build fails in the link stage:

    $ mkdir Hello
    $ cd Hello
    $ cat > Hello.cpp
    #include <QtGui>

    int main(int argc, char *argv[])
    QApplication app(argc, argv);
    QLabel label("Hello, world!");
    return app.exec();
    $ qmake-qt4 -project
    $ qmake-qt4 Hello.pro
    $ make
    g++-4 -o Hello.exe Hello.o -L/usr/lib/qt4/lib -lQtGui -L/usr/lib/qt4/lib -laudio -lXt -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lexpat -lfreetype -lXext -lX11 -lQtCore -lz -lm -lgthread-2.0 -lglib-2.0 -lintl -liconv -ldl -lpthread
    Hello.o:Hello.cpp:(.text+0x21): undefined reference to ___gxx_personality_sj0' Hello.o:Hello.cpp:(.text+0x45): undefined reference to__Unwind_SjLj_Register'
    Hello.o:Hello.cpp:(.text+0x143): undefined reference to __Unwind_SjLj_Unregister' Hello.o:Hello.cpp:(.text+0x1b8): undefined reference to__Unwind_SjLj_Resume'
    collect2: ld returned 1 exit status
    make: *** [Hello.exe] Error 1

    Before I spend a potentially long, long time digging into this, I wondered if this was a well known problem with an easy solution.



    $ cygcheck -c | fgrep -i qt
    libQt3Support4 4.5.3-1 OK
    libQtAssistantClient4 4.5.3-1 OK
    libQtAssistantClient4-devel 4.5.3-1 OK
    libQtCore4 4.5.3-1 OK
    libQtCore4-devel 4.5.3-1 OK
    libQtDBus4 4.5.3-1 OK
    libQtDBus4-devel 4.5.3-1 OK
    libQtDesigner4 4.5.3-1 OK
    libQtDesigner4-devel 4.5.3-1 OK
    libQtGui4 4.5.3-1 OK
    libQtGui4-devel 4.5.3-1 OK
    libQtHelp4 4.5.3-1 OK
    libQtHelp4-devel 4.5.3-1 OK
    libQtNetwork4 4.5.3-1 OK
    libQtNetwork4-devel 4.5.3-1 OK
    libQtOpenGL4 4.5.3-1 OK
    libQtOpenGL4-devel 4.5.3-1 OK
    libQtScript4 4.5.3-1 OK
    libQtScript4-devel 4.5.3-1 OK
    libQtScriptTools4 4.5.3-1 OK
    libQtScriptTools4-devel 4.5.3-1 OK
    libQtSql4 4.5.3-1 OK
    libQtSql4-devel 4.5.3-1 OK
    libQtSvg4 4.5.3-1 OK
    libQtSvg4-devel 4.5.3-1 OK
    libQtTest4 4.5.3-1 OK
    libQtTest4-devel 4.5.3-1 OK
    libQtWebKit4 4.5.3-1 OK
    libQtWebKit4-devel 4.5.3-1 OK
    libQtXml4 4.5.3-1 OK
    libQtXml4-devel 4.5.3-1 OK
    libQtXmlPatterns4 4.5.3-1 OK
    libQtXmlPatterns4-devel 4.5.3-1 OK
    pinentry-qt4 0.7.6-3 OK
    qt4-devel-tools 4.5.3-1 OK
    qt4-doc 4.5.3-1 OK
    qt4-qtconfig 4.5.3-1 OK
    qt4-qtdemo 4.5.3-1 OK

Log in to reply