- 论坛徽章:
- 0
|
各位大侠:
最近在做嵌入式开发。
原来的交叉编译环境是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
复制代码 Test.cpp- #include "Test.h"
- Test::Test()
- {
- }
- Test::~Test()
- {
- }
复制代码 在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操作已经过时,可也没找到个例子,哪位仁兄能帮忙解释下,或者给个demo。不胜感激 |
|