Sandundhammika's Blog











{March 20, 2010}   QT mingw gcc 3.4.2 problem

Hi all , I’m using g++ 3.4.2 and I had downloaded the latest QT SDK (with source code) from

Nokia. And just type ‘QT tutorial’ in google and get this page.

http://doc.trolltech.com/4.3/tutorial.html

and I add the g++ and QT /bin folder to PATH environment variable and write the first program

and save it as tutorial1.cc.


/****************************************************************************
* Qt tutorial
*
*
*****************************************************************************/
#include <qapplication.h>
#include <qpushbutton.h>

int main ( int argc , char ** argv )
{
QApplication a(argc,argv);

QPushButton hello( "hello World!",0);
hello.resize(100,30);

//a.setMainWidget(&hello);
hello.show();
return a.exec();
}

and to compile and link this I hit ,


J:\EXERCI~1\QT4>qmake

J:\EXERCI~1\QT4>make -f Makefile.debug

Then I had received these errors.

I get discouraged, but finally I google  those symbols,those symbols are ,


C:\iwmake\build_mingw_opensource\src\winmain/qtmain_win.cpp:93: undefined refere
nce to `_Unwind_Resume'
C:\iwmake\build_mingw_opensource\src\winmain/qtmain_win.cpp:135: undefined refer
ence to `_Unwind_Resume'
c:/Qt/4.6.2/lib/libqtmaind.a(qtmain_win.o):C:\iwmake\build_mingw_opensource\src\
winmain/../../include/QtCore/../../src/corelib/tools/qvector.h:482: undefined re
ference to `_Unwind_Resume'
c:/Qt/4.6.2/lib/libqtmaind.a(qtmain_win.o):C:\iwmake\build_mingw_opensource\src\
winmain/../../include/QtCore/../../src/corelib/tools/qvector.h:483: undefined re
ference to `_Unwind_Resume'
c:/Qt/4.6.2/lib/libqtmaind.a(qtmain_win.o):qtmain_win.cpp:(.eh_frame+0x12): unde
fined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Just two symbols,

__gxx_personality_v0

_Unwind_Resume

So googling resulted me these things,

http://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for

as as they tell , they told to declare those symbols as void * , then I change the source code

like this.


/****************************************************************************
 * Qt tutorial
 *
 *
*****************************************************************************/
#include <qapplication.h>
#include <qpushbutton.h>

void * __gxx_personality_v0=0;
void * _Unwind_Resume =0;

int main ( int argc , char ** argv )
{
 QApplication a(argc,argv);

 QPushButton hello( "hello World!",0);
 hello.resize(100,30);

 //a.setMainWidget(&hello);
 hello.show();
 return a.exec();
}

Then it resolved the linked errors, and in the .\debug directory I got the QT4.exe file, and it running nicely. BINGO.

BUT not BINGO , because those are some two functions that used for exception handling and

stack unwinding. So we declare them to zero. If exception occurred or somehow will invoke

these functions it will crash with the error message Invalid Memory access ( because we

can’t access the memory location at 0x00000000h ,in the protected mode under win32 no !

anyway this is a KLUDGE hack ,the right thing is implement these functions.

–Happy Coding–

Advertisements


panfider says:

Do you use MingW on Windows ?
You look nice to solve with symbol problem ?
I will try to work with old gcc compiler instead of new gcc-4.5!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

et cetera
%d bloggers like this: