This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: More template(s) errors with GCC3.2-7


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]