LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 964|回复: 1

我搞不定了:error compiling; 'redeclared with different access'

[复制链接]
发表于 2007-5-22 13:48:12 | 显示全部楼层 |阅读模式
我实在搞不定了,在网上这个编译错误的讨论也很少,请高手指点!!!多谢多谢
-----------编译时命令行内容:-------------------
[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内容:------------------


// 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
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表