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: Compile errors


Corey,

I did a couple of things:
- Added the following as you suggested:
  using std::hash; in the .cc file.

- Removed stl_hash_fun.h and tried to compile. 

I get the exact same errors as my original posting in
both the cases.

Parms
--- corey taylor <corey.taylor@gmail.com> wrote:
> Parms,
> 
>   You are using the stl_hash_fun.h header file so
> hash is declared
> inside the stl namespace.  You need to fully qualify
> it with the std::
> namespace or add
> 
> using std::hash; 
> 
> Beneath the includes.
> 
> corey
> 
> On Mon, 28 Mar 2005 09:29:10 -0800 (PST), Parms
> singh
> <list_track@yahoo.com> wrote:
> > Hello,
> > 
> > I am running gcc version 3.2.2 20030222 (Red Hat
> Linux
> > 3.2.2-5).
> > 
> > I am a relative newbee to c++ (haven't used it in
> a
> > while).
> > 
> > In my .h file:
> > #include <ext/stl_hash_fun.h>
> > #include <ext/hash_map>
> > 
> > class HTEntry {
> > public:
> >         double time;
> >         double ttl;
> > };
> > 
> > typedef hash_map<int, pair<int,HTEntry>,
> hash<int>,
> > equal_to<int> > HMap;
> > 
> > class Hash_Table
> > {
> > public:
> >         void increment(int, double, double);
> >         int lookup(int,double,double);
> >         int findsize(double,bool);
> >         int estimate_hit(double);
> > protected:
> >         HMap flows;
> > };
> > 
> > In the .cc file:
> > #include <iostream>
> > #include <sstream>
> > #include <cmath>
> > #include <valarray>
> > #include <string>
> > #include <sys/types.h>
> > #include "config.h"
> > #include "template.h"
> > #include "flags.h"
> > #include "delay.h"
> > #include "rd.h"
> > 
> > using namespace std;
> > 
> > void Hash_Table::increment(int id, double t_now,
> > double ttl)
> > {
> >         HMap::iterator iter;
> >         iter=flows.find(id);
> >         double timelived, thresh;
> >         int hits;
> >  // bunch of stuff
> > }
> > 
> > //other functions that I leave out.
> > 
> > Errors:
> > In file included from qd.cc:78:
> > qd.h:154: `hash' was not declared in this scope
> > qd.h:154: parse error before `>' token
> > qd.h:173: 'HMap' is used as a type, but is not
> defined
> > as a type.
> > qd.cc: In member function `void
> > Hash_Table::increment(int, double, double)':
> > qd.cc:1232: `HMap' undeclared (first use this
> > function)
> > qd.cc:1232: (Each undeclared identifier is
> reported
> > only once for each
> >    function it appears in.)
> > qd.cc:1232: parse error before `::' token
> > qd.cc:1233: `iter' undeclared (first use this
> > function)
> > qd.cc:1233: `flows' undeclared (first use this
> > function)
> > qd.cc: In member function `int
> > Hash_Table::findsize(double, bool)':
> > qd.cc:1274: parse error before `::' token
> > qd.cc: In member function `int
> Hash_Table::lookup(int,
> > double, double)':
> > qd.cc:1360: parse error before `::' token
> > make: *** [qd.o] Error 1
> > 
> > Similar errors for other functions removed for
> > simplicity.
> > 
> > Any help is appreciated.
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Small Business - Try our new resources
> site!
> > http://smallbusiness.yahoo.com/resources/
> >
> 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


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