Mail Archives: djgpp/1999/09/21/03:24:08
On 20 Sep 1999, Jari Karppinen wrote:
> I wrote a simple templatized vector class. There was no trouble
> compiling the source with egcs-1.1.2, but after I switched to
> gcc-2.95, I got the following:
>
> vec.cc: In instantiation of `Vector<int>':
> vec.cc:285: instantiated from here
> vec.cc:44: invalid use of undefined type `class Vector<int>'
> vec.cc:48: forward declaration of `class Vector<int>'
> vec.cc:44: confused by earlier errors, bailing out
>
> I made no changes to the source, and can't see why this happens. I would
> really appreciate advice from experts.
I cannot answer why this happens. At least I have verified in Linux that
it's so (gcc-2.95.1 gives errors, egcs-2.91.66.1 compiles Ok). It's known
that newer versions of gcc does more strict syntactical checking of source
and as result there may be problems. Use of option -fpermissive to turn
off default -fpedantic-errors for C++ compiler also doesn't help in this
case.
I suggest making smaller test example (to be more sure somebody will take
a look at it) and to ask a question in gcc mailing list (gcc AT gcc DOT gnu DOT org).
Andris
- Raw text -