Re: Compile errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Corey:

When I put the 'using std::hash;' line in the .h file,
I get an additional error that says
'hash' not declared (as shown below). The line number
corresponds to the new line.

On moving the 'using std::hash' line to the .cc file,
the error is exactly as before (only the above
mentioned error is missing). 

I read in a couple of postings that such declarations
ought to be made in the .cc file.

Parms

In my .h file:
#include <ext/stl_hash_fun.h>
#include <ext/hash_map>
using std::hash;

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:74: 'hash' not declared
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.

--- corey taylor <corey.taylor@xxxxxxxxx> wrote:
> Parms,
> 
>   Can you post what you have now?
> 
> corey
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux