|

楼主 |
发表于 2007-5-22 13:52:58
|
显示全部楼层
我搞不定了:error compiling; 'redeclared with different access'
我实在搞不定了,在网上这个编译错误的讨论也很少,请高手指点!!!多谢多谢
注:这是澳大利亚大学的一个community media streaming开源项目,按说明下载后编译不该出错的。
-----------编译时命令行内容:-------------------
[root@RHEL4-KZY live_trevbus_2b]# make
cd BasicUsageEnvironment ; make
make[1]: Entering directory `/home/kzy/live_trevbus_2b/BasicUsageEnvironment'
gcc -c -Iinclude -I../UsageEnvironment/include -I../groupsock/include -I. -O -DSOCKLEN_T=socklen_t -Wall -DBSD=1 BasicHashTable.cpp
In file included from BasicHashTable.cpp:20:
include/BasicHashTable.hh:66: error: class BasicHashTable::TableEntry redeclared with different access
make[1]: *** [BasicHashTable.o] 错误 1
make[1]: Leaving directory `/home/kzy/live_trevbus_2b/BasicUsageEnvironment'
make: *** [BasicUsageEnvironment/BasicUsageEnvironment.a] 错误 2
以下是BasicHashTable.hh的内容
-----------BasicHashTable.hh内容:------------------
// Copyright (c) 1996-2000 Live Networks, Inc. All rights reserved.
// Basic Hash Table implementation
// C++ header
#ifndef _BASIC_HASH_TABLE_HH
#define _BASIC_HASH_TABLE_HH
#ifndef _HASH_TABLE_HH
#include "HashTable.hh"
#endif
// A simple hash table implementation, inspired by the hash table
// implementation used in Tcl 7.6: <http://www.tcl.tk/>
#define SMALL_HASH_TABLE_SIZE 4
class BasicHashTable: public HashTable {
public:
BasicHashTable(int keyType);
virtual ~BasicHashTable();
class TableEntry; // forward
// Used to iterate through the members of the table:
class Iterator: public HashTable::Iterator {
public:
Iterator(BasicHashTable& table);
private: // implementation of inherited pure virtual functions
void* next(char const*& key); // returns 0 if none
private:
BasicHashTable& fTable;
unsigned fNextIndex; // index of next bucket to be enumerated after this
TableEntry* fNextEntry; // next entry in the current bucket
};
private: // implementation of inherited pure virtual functions
virtual void* Add(char const* key, void* value);
// Returns the old value if different, otherwise 0
virtual Boolean Remove(char const* key);
virtual void* Lookup(char const* key) const;
// Returns 0 if not found
virtual Boolean IsEmpty() const;
private:
class BasicHashTable: public HashTable {
public:
BasicHashTable(int keyType);
virtual ~BasicHashTable();
class TableEntry; // forward
// Used to iterate through the members of the table:
class Iterator: public HashTable::Iterator {
public:
Iterator(BasicHashTable& table);
private: // implementation of inherited pure virtual functions
void* next(char const*& key); // returns 0 if none
private:
BasicHashTable& fTable;
unsigned fNextIndex; // index of next bucket to be enumerated after this
TableEntry* fNextEntry; // next entry in the current bucket
};
private: // implementation of inherited pure virtual functions
virtual void* Add(char const* key, void* value);
// Returns the old value if different, otherwise 0
virtual Boolean Remove(char const* key);
virtual void* Lookup(char const* key) const;
private: // implementation of inherited pure virtual functions
void* next(char const*& key); // returns 0 if none
private:
BasicHashTable& fTable;
unsigned fNextIndex; // index of next bucket to be enumerated after this
TableEntry* fNextEntry; // next entry in the current bucket
};
private: // implementation of inherited pure virtual functions
virtual void* Add(char const* key, void* value);
// Returns the old value if different, otherwise 0
virtual Boolean Remove(char const* key);
virtual void* Lookup(char const* key) const;
// Returns 0 if not found
virtual Boolean IsEmpty() const;
private:
class TableEntry {
public:
TableEntry* fNext;
char const* key;
void* value;
};
TableEntry* lookupKey(char const* key, unsigned& index) const;
// returns entry matching "key", or NULL if none
Boolean keyMatches(char const* key1, char const* key2) const;
// used to implement "lookupKey()"
TableEntry* insertNewEntry(unsigned index, char const* key);
// creates a new entry, and inserts it in the table
void assignKey(TableEntry* entry, char const* key);
// used to implement "insertNewEntry()"
void deleteEntry(unsigned index, TableEntry* entry);
void deleteKey(TableEntry* entry);
// used to implement "deleteEntry()"
void rebuild(); // rebuilds the table as its size increases
unsigned hashIndexFromKey(char const* key) const;
// used to implement many of the routines above
unsigned randomIndex(unsigned i) const {
return (((((long) (i))*1103515245) >> fDownShift) & fMask);
}
private:
friend class Iterator;
TableEntry** fBuckets; // pointer to bucket array
TableEntry* fStaticBuckets[SMALL_HASH_TABLE_SIZE];// used for small tables
unsigned fNumBuckets, fNumEntries, fRebuildSize, fDownShift, fMask;
int fKeyType;
};
#endif |
|