我在ADS的text file中定义如下的基类:
//消息处理基类
#ifndef _OBJECT_H_
#define _OBJECT_H_
#include "config.h"
class CObject{
public:
virtual void WndProc(uint32 type, uint32 dat1, uint32 dat2, uint32 dat3);
//virtual void OnTimer(uint8 timerID);
};
#endif
就会出现如题所示的错误提示。这是什么原因啊?好事困惑,已经找了好久了也没有找到一个合适的方法。那位高手指点迷津。
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'class'
object.h line 11
Error : C2285E: expected ';' or ',' - inserted ';' before 'CObject'
object.h line 11
Error : C2483E: Ancient form of initialisation, use '='
object.h line 11
Error : C2456E: undeclared name, inventing 'extern int public'
object.h line 12
Error : (Serious) C2282E: expected '}' - inserted before ':'
object.h line 12
Error : (Serious) C2432E: non-constant initialiser
object.h line 12
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'CObject'
object.h line 13
Error : C2285E: expected ';' or ',' - inserted ';' before 'virtual'
object.h line 13
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'virtual'
object.h line 13
Error : C2285E: expected ';' or ',' - inserted ';' before 'void'
object.h line 13
Error : (Serious) C2322E: Expecting or but found '}'
object.h line 15
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'class'
meter.h line 22
Error : C2285E: expected ';' or ',' - inserted ';' before 'CMeter'
meter.h line 22
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'CMeter'
meter.h line 22
Error : C2285E: expected ';' or ',' - inserted ';' before ':'
meter.h line 22
Error : (Serious) C2322E: Expecting or but found ':'
meter.h line 22
Error : C2285E: expected ';' or ',' - inserted ';' before '{'
meter.h line 23
Error : (Serious) C2337E: Misplaced '{' at top level - ignoring block
meter.h line 23
Warning : C2917W: no side effect in void context: 'virtual'
meter.h line 27
Error : (Serious) C2284E: expected ';' after command - inserted before 'BOOL'
meter.h line 27
Error : (Serious) C2292E: typedef name 'BOOL' used in expression context
meter.h line 27
Error : (Serious) C2284E: expected ';' after command - inserted before 'GetDataId'
meter.h line 27
Warning : C2207W: inventing 'extern int GetDataId();'
meter.h line 27
Error : (Serious) C2292E: typedef name 'uint16' used in expression context
meter.h line 27
Error : C2285E: expected ')' or ',' - inserted ')' before 'DataId'
meter.h line 27
Error : (Serious) C2284E: expected ';' after command - inserted before 'DataId'
meter.h line 27
Error : C2456E: undeclared name, inventing 'extern int DataId'
meter.h line 27
Error : (Serious) C2292E: typedef name 'uint8' used in expression context
meter.h line 27
Error : C2456E: undeclared name, inventing 'extern int pBuf'
meter.h line 27
Error : (Serious) C2292E: typedef name 'uint16' used in expression context
meter.h line 27
Error : C2456E: undeclared name, inventing 'extern int pSize'
meter.h line 27
Error : (Serious) C2284E: expected ';' after command - inserted before ')'
meter.h line 27
Error : (Fatal) C3047U: Too many errors
meter.h line 27
Error : (Serious) C2857E: #include file "Meater.h" wouldn't open
485meter.cpp line 8
Error : (Serious) C2857E: #include file "485meater.h" wouldn't open
485meter.cpp line 9
Error : C2467E: missing type specification for 'DateTimeType' - 'int' assumed
485meter.cpp line 15
Error : C2285E: expected ';' or ',' - inserted ';' before 'SysDateTime'
485meter.cpp line 15
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'SysDateTime'
485meter.cpp line 15
Error : (Serious) C2934E: duplicate definition of 'DateTimeType'
485meter.cpp line 16
Error : C2467E: missing type specification for 'DateTimeType' - 'int' assumed
485meter.cpp line 16
Error : C2285E: expected ';' or ',' - inserted ';' before 'gSysDateTime'
485meter.cpp line 16
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'gSysDateTime'
485meter.cpp line 16
Error : (Serious) C2365E: class-name 'CMeter' not found
485meter.cpp line 24
Error : (Serious) C2365E: class-name 'CMeter' not found
485meter.cpp line 33
Error : C2456E: undeclared name, inventing 'extern int m_TimeBuf'
485meter.cpp line 36
Error : C3029E: '=': implicit cast of non-0 int to pointer
485meter.cpp line 36
Error : (Serious) C2947E: Illegal types for operands: '.'
485meter.cpp line 39
Error : (Serious) C2947E: Illegal types for operands: '.'
485meter.cpp line 40
Error : (Serious) C2947E: Illegal types for operands: '.'
485meter.cpp line 42
Error : (Serious) C2947E: Illegal types for operands: '.'
485meter.cpp line 43
Error : (Serious) C2947E: Illegal types for operands: '.'
485meter.cpp line 44
Error : (Serious) C2365E: class-name 'CMeter' not found
485meter.cpp line 48
Error : C2456E: undeclared name, inventing 'extern int m_MeterType'
485meter.cpp line 55
Error : C2456E: undeclared name, inventing 'extern int METERTYPE_485'
485meter.cpp line 55
Error : (Serious) C2947E: Illegal types for operands:
485meter.cpp line 55
Error : C2457E: undeclared name, inventing 'extern "C" int memcpy(...);'
485meter.cpp line 61
Error : (Serious) C2365E: class-name 'C485Meter' not found
485meter.cpp line 72
Error : C2218W: implicit 'int' return type for 'C485Meter' - 'void' intended?
485meter.cpp line 73
Error : (Serious) C2365E: class-name 'C485Meater' not found
485meter.cpp line 78
Warning : C2870W: variable 'no' declared but not used
485meter.cpp line 80
Error : (Serious) C2365E: class-name 'C485Meater' not found
485meter.cpp line 83
Error : (Serious) C2934E: duplicate definition of 'GetDataId(unsigned short, unsigned char*, unsigned short*)'
485meter.cpp line 84
Error : C2457E: undeclared name, inventing 'extern "C" int printf(...);'
485meter.cpp line 85
Warning : C2870W: variable 'pSize' declared but not used
485meter.cpp line 87
Warning : C2870W: variable 'pBuf' declared but not used
485meter.cpp line 87
Error : (Serious) C2365E: class-name 'CMeater' not found
485meter.cpp line 89
Warning : C2870W: variable 'pSize' declared but not used
485meter.cpp line 92
Warning : C2870W: variable 'pBuf' declared but not used
485meter.cpp line 92
Warning : C2870W: variable 'DataId' declared but not used
485meter.cpp line 92
G:\电能表\GdPower\GdPower\485meter.cpp: 6 warnings, 13 errors, 17 serious errors
关注ing,我在用C++定义类的时候也出现这样的错误。是不是ADS不支持C++类啊?还是哪个地方没设置好?
话说我照着树上吵了一段简单的汇编都出现一大堆这样的错误,郁闷a啊~