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

Discussion in 'C++' started by zl2k, May 14, 2006.

  1. zl2k

    zl2k Guest

    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
     
    zl2k, May 14, 2006
    #1
    1. Advertising

  2. zl2k

    Mark P Guest

    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
     
    Mark P, May 14, 2006
    #2
    1. Advertising

  3. zl2k

    zl2k Guest

    Thanks Mark, you are right. By using the namespace __gnu_cxx, it works.

    zl2k
     
    zl2k, May 14, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Ying
    Replies:
    2
    Views:
    618
    James Ying
    Oct 28, 2003
  2. Bart Blommerde

    using hash_set in gcc3.3

    Bart Blommerde, Oct 13, 2004, in forum: C++
    Replies:
    5
    Views:
    533
    John Harrison
    Oct 13, 2004
  3. Timo Qvist

    STL hash_set problem, SGI impl

    Timo Qvist, Nov 18, 2004, in forum: C++
    Replies:
    1
    Views:
    891
    Victor Bazarov
    Nov 18, 2004
  4. Pierre Couderc
    Replies:
    2
    Views:
    5,331
  5. eric
    Replies:
    3
    Views:
    1,364
    Michael DOUBEZ
    Jul 12, 2011
Loading...

Share This Page