- 論壇徽章:
- 0
|
各位大俠:
最近在做嵌入式開發(fā)。
原來的交叉編譯環(huán)境是arm-linux-gcc 3.4.1,源碼如下:
Test.h- #ifndef _TEST_
- #define _TEST_
- #include <hashtable.h>
- class Test{
- public:
- Test();
- ~Test();
- private:
- typedef struct {
- int nKey;
- }KeyNode;
-
- typedef int (* HASHER)(int);
- typedef int (* EXTRACTOR)(KeyNode);
- typedef bool (* EQUALFUNC)(int, int);
- typedef hashtable<KeyNode, int, HASHER, EXTRACTOR, EQUALFUNC> _CONN_HASH;
- static int hasher(int key) { return key; }
- static int extractor(KeyNode val) { return val.nKey; }
- static bool equalkey(int key1, int key2) { return key1 == key2; }
- _CONN_HASH* m_pConnHash;
- };
- #endif
復(fù)制代碼 Test.cpp- #include "Test.h"
- Test::Test()
- {
- }
- Test::~Test()
- {
- }
復(fù)制代碼 在3.4.1編譯正常。
但移到4.4.3后提示錯誤信息如下:
arm-linux-g++ -g -Wall -DDEBUG -D_REENTRANT -shared -lpthread -L./lib -I./inc -o./lib/Test.so ./src/Test.cpp
In file included from ./src/Test.cpp:1:
./inc/Test.h:22: error: ISO C++ forbids declaration of 'hashtable' with no type
./inc/Test.h:22: error: expected ';' before '<' token
./inc/Test.h:28: error: ISO C++ forbids declaration of '_CONN_HASH' with no type
./inc/Test.h:28: error: expected ';' before '*' token
make: *** [../lib/Test.so] 錯誤 1
查了下,貌似說4.0版本后的hashtable操作已經(jīng)過時,可也沒找到個例子,哪位仁兄能幫忙解釋下,或者給個demo。不勝感激 |
|