This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: More template(s) errors with GCC3.2-7
- From: Oscar Fuentes <ofv at wanadoo dot es>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 23 Apr 2003 02:21:36 +0200
- Subject: Re: More template(s) errors with GCC3.2-7
- Cancel-lock: sha1:vjmERmPPl0dOAkry3gkmtYWUL2M=
- References: <BACADC4D.8475%eljay@adobe.com> <1051051041.1191.10.camel@Vaio>
Rade Trimceski <rtrimces at mtu dot edu> writes:
> Can someone demystify this error for me?
>
> It comes out of a header file, and this did compile with gcc 2.96.
>
> typedef hash_map<int, Neighbor_Entry *> Neighbors_Hash;
>
> the compilation error is:
>
> In file included from diffusion3/apps/gear/geo-routing.cc:11:
> diffusion3/apps/gear/geo-routing.hh:187: syntax error before `;' token
>
>
> Any ideas why I get the syntax error, and what it really means?
Well, the error message is not a great help on this case. What really
happens is that 'hash_map' is an unknown template for the compiler.
GCC 3.x comes with a new Standard C++ Library implementation, which is
far more conformant than the previous one. All standard C++ library
names are on namespace 'std'.
For this specific case, 'hash_map' is not a standard C++ library
template. However, the GNU implementors added it for supporting old
code (and as a nice extension, I guess). It's on namespace __gnu_cxx,
implemented on <ext/hash_map>.
I think this issues are explained on some README on the GCC
distribution or on the website. The 'std' namespace thing is something
every C++ developer should know since a long time ago, though.
--
Oscar