typeid with Qt throws exception

Discussion in 'C++' started by Gil Grissom, Aug 6, 2005.

  1. Gil Grissom

    Gil Grissom Guest

    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:eek:leaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll
    /DELAYLOAD:winspool.dll /DELAYLOAD:eek:pengl32.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
     
    Gil Grissom, Aug 6, 2005
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Aug 6, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Himmat Dhange
    Replies:
    0
    Views:
    456
    Himmat Dhange
    Aug 26, 2003
  2. Cowboy \(Gregory A. Beamer\)
    Replies:
    1
    Views:
    831
    =?Utf-8?B?amhpbGw=?=
    May 16, 2004
  3. Aren Cambre
    Replies:
    5
    Views:
    4,203
  4. Chris Miller
    Replies:
    4
    Views:
    13,563
    Chris Smith
    Nov 22, 2003
  5. Replies:
    2
    Views:
    357
Loading...

Share This Page