"export" keyword is used as a method name

Ian Lance Taylor iant@google.com
Wed Sep 22 05:20:00 GMT 2010

Michael Gong <gongweigang@gmail.com> writes:

> When "export" is used as a method name in a class (see example below),
>  I compiled it using SunStudio C++ compiler with "-compat" option.
> I wonder can g++ compile it and which option to use ?
> Example:
> class A {
>     void export();
> };
> int main () { return 0; }

"export" is a keyword in C++, and has been ever since the C++98
standard.  g++ does not have any option to make it not be a keyword.

I suppose you could use a hack like -Dexport=myexport.


More information about the Gcc-help mailing list