By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,502 Members | 1,177 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,502 IT Pros & Developers. It's quick & easy.

typeid with Qt throws exception

P: n/a
Hi,

I have a problem with Qt and the use of the rtti features.

I compiled Qt and the included examples with the intel c++ compiler 8.1
like the following commands show:

icl -c -nologo -Zm200 -W3 -MD -GX -GX -GR -DUNICODE -DQT_DLL
-DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"C:\Qt\3.3.4\include" -I"."
-I"tmp\moc\release_mt_shared" -I"C:\Qt\3.3.4\mkspecs\win32-icc"
-Fotmp\obj\release_mt_shared\ @C:\DOKUME~1\user\LOKALE~1\Temp\nm84.tmp
main.cpp

link /NOLOGO delayimp.lib /DELAYLOAD:comdlg32.dll
/DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll
/DELAYLOAD:winspool.dll /DELAYLOAD:opengl32.dll /SUBSYSTEM:windows
/LIBPATH:"C:\Qt\3.3.4\lib" /OUT:aclock.exe
@C:\DOKUME~1\user\LOKALE~1\Temp\nm85.tmp

The examples aclock.exe works fine and the whole Qt lib as well.

Now I changed the code of main.cpp in the aclock example and added the
following lines:

QRadioButton *button = new QRadioButton(0,"TestButton");
char name[1024];
sprintf( name, "\"%s\" \"%s\" (\"%s\")",
button->name(), button->className(),
typeid( *button ).name() );
clock->setCaption(name);

The calls of typeid(*button) fails with the following message:

"Runtime Error!
...
This application has requested the Runtime to terminate it in an unusual
way. Please contact the application's support for more information."

But typeid(button) and typeid(*clock) work fine!

Whats wrong with this? What can I do?

Thanks in advance,
Gil
Aug 6 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Gil Grissom wrote:
I have a problem with Qt and the use of the rtti features.
[...]


Then go to their web site and read, or write to, their online
discussion forums. This newsgroup is about C++ _language_, not
about any particular product.

Are you sure your pointer is not null when you try to dereference
it when taking 'typeid' of it?

V
Aug 6 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.