C++ Bug compiling the 'virtual' keyword
Mike Stump
mrs@windriver.com
Tue Jun 6 13:45:00 GMT 2000
> Date: Tue, 06 Jun 2000 16:35:53 +1000
> From: Adam Pierce <adam@indigointeractive.com.au>
> I've just installed gcc-2.95.2 on my Sparc/Solaris 7 box and have
> noticed an odd problem.
> If I put this in /usr/local/include, my source files (located
> elsewhere) can include it and it compiles perfectly. However, if I
> move the header file to /usr/include, or any subdirectory under
> /usr/include, I get this:
> [ errors ]
> This is not really an acceptable workaround because I can no longer
> use 'virtual'.
> Sorry if this description was a bit long-winded but I haven't been
> able to isolate the problem any more than this. This is really
> causing havoc with my current project. Please let me know if there
> is some way I can fix this.
Yes, fix, only the OS vendor should put files into /usr/include. Are
you an OS vendor? If so, the /usr/include directory is for C language
headers. You have a C++ language header. C++ language headers don't
go there. You should put them in the C++ include directory, consult
the rest of your team on where this is. I suspect /usr/include/g++-2.
If you can't or don't want to do this, then wrap in extern "C++" { }
to switch languages.
If you're not an OS vendor, then put them into /usr/local/include...
Or some other location and use -I as necessary.
:-)
More information about the Gcc-bugs
mailing list