Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > newbie Q: how to use stl hash_set in gcc3.4.4

Reply
Thread Tools

newbie Q: how to use stl hash_set in gcc3.4.4

 
 
zl2k
Guest
Posts: n/a
 
      05-14-2006
hi, there

Can someone let me know how may I use the stl hash_set in gcc3.4.4?
Here is my code:
======================
#include <ext/hash_set>

using namespace std;

int main (void)
{
hash_set<int> hs; //error message "`hash_set' undeclared (first use
this function)"
return 0;
}
======================
Thanks ahead.

zl2k

 
Reply With Quote
 
 
 
 
Mark P
Guest
Posts: n/a
 
      05-14-2006
zl2k wrote:
> hi, there
>
> Can someone let me know how may I use the stl hash_set in gcc3.4.4?
> Here is my code:
> ======================
> #include <ext/hash_set>
>
> using namespace std;
>
> int main (void)
> {
> hash_set<int> hs; //error message "`hash_set' undeclared (first use
> this function)"
> return 0;
> }
> ======================
> Thanks ahead.
>
> zl2k
>


Probably your system (rightly) puts hash_table in a namespace other than
std. You can look in your system's include directories to see how it's
defined. I'm using an older version of gcc and it looks like it's
within namespace __gnu_cxx

-Mark
 
Reply With Quote
 
 
 
 
zl2k
Guest
Posts: n/a
 
      05-14-2006
Thanks Mark, you are right. By using the namespace __gnu_cxx, it works.

zl2k

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
hash_set was not declared even I #include<hash_set> eric C++ 3 07-12-2011 10:27 AM
How to use hash_set Paulo da Silva C++ 2 06-19-2007 02:42 AM
Tutorial and example to SGI STL hash_set Pierre Couderc C++ 2 12-30-2006 09:12 AM
STL hash_set problem, SGI impl Timo Qvist C++ 1 11-18-2004 03:04 PM



Advertisments