RTTI macro & g++

Started by
1 comment, last by aboeing 20 years, 1 month ago
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.
Advertisement
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]
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?

This topic is closed to new replies.

Advertisement