compilation problem with g++ when volatile is used
Ooi Boon Pin
bpooi@gintic.gov.sg
Thu Feb 24 08:50:00 GMT 2000
Hi,
I'm facing a problem when I compile my C++ program. Here is a sample code
which gives problem:
main()
{
int hello=0;
(volatile) hello=1;
}
When the file with this code is saved with .c extension, compilation (with
either g++ or gcc) went fine. But when I saved the file with .cpp extension,
and compile the file, it gives me the error of
ANSI C++ forbidden variable with no type for the [(volatile) hello=1]
statement. May I know how can I workaround this problem?
By the way, my system is running Sun Solaris version 2.6, and the version of
gcc compiler that I'm using is 2.95.2.
Please advise.
Regards,
Boon Ping
More information about the Gcc-bugs
mailing list