Archived

This topic is now archived and is closed to further replies.

RTTI macro & g++

This topic is 5010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I cant seem to find any macro that is defined if g++ has rtti enabled or not. According to a document I read somewhere __RTTI should be defined, but that doesnt seem to be the case. Does anyone know if a macro does get defined, and what it is? Alternatively a way to create an error at compile-time if rtti is not available? (turn of rtti via : g++ -fno-rtti) Thanks.

Share this post


Link to post
Share on other sites
Do you mean you can't find it defined in a file?

It won't be in a file but it will be as if its defined on the command line.

Try compiling this with the rtti enabled/disabled


#include <iostream>
int main() {
#ifdef __RTTI
std::cout << "Rtti enabled\n";
#endif
#ifndef __RTTI
std::cout << "Rtti disabled\n";
#endif
return 0;
}


Some docs I found said it was only for Tru64 so maybe that's your problem.

[edited by - petewood on March 25, 2004 4:23:24 AM]

Share this post


Link to post
Share on other sites
Hi yeah, thanks, I tried that.
Perhaps I have the RTTI switches wrong?
g++ -fno-rtti
and
g++ -frtti

also, if you use the -v option, I assume gcc displays all the #defines? is this correct? because I cant see any difference in the information it displays if rtti is enabled/disabled.

quote:

Alternatively a way to create an error at compile-time if rtti is not available?


Any ideas?

Share this post


Link to post
Share on other sites