读书人

这个很简单的头文件如何会报错?看看代

发布时间: 2012-08-08 14:32:45 作者: rapoo

这个很简单的头文件怎么会报错?看看代码

C/C++ code
#ifndef _INSPECT_ERROR_HANDLER_H_#define _INSPECT_ERROR_HANDLER_H_#include <map>#include <string>#include <fstream>#include "Macros.h"#include "..\\..\\..\\MAGIC-1DataLib\\Inc\\MAGIC-1Enum.h"namespace nsInspection{    USING_STD(string);    USING_STD(map);    USING_STD(fstream);        typedef enum tagErrorCode    {        NO_ERROR,        ERR_NO_CONTOUR,        ERR_PEAK_POINTS_NUM,        ERR_CORNER_POINTS_NUM,        ERR_INTERESTING_POINTS_NUM,        ERR_OUT_OF_INDEXES,        ERR_DIVIDE_BY_ZERO,    }ErrorCode;    static const struct    {        string _strErrorCode;        ErrorCode  _enumErrorCode;    } ErrorCodeStrings[] =     {        { "NO_ERROR",                    ErrorCode::NO_ERROR },         { "ERR_NO_CONTOUR",                ErrorCode::ERR_NO_CONTOUR },         { "ERR_PEAK_POINTS_NUM",        ErrorCode::ERR_PEAK_POINTS_NUM },        { "ERR_CORNER_POINTS_NUM",        ErrorCode::ERR_CORNER_POINTS_NUM },        { "ERR_INTERESTING_POINTS_NUM", ErrorCode::ERR_INTERESTING_POINTS_NUM },        { "ERR_OUT_OF_INDEXES",            ErrorCode::ERR_OUT_OF_INDEXES },        { "ERR_DIVIDE_BY_ZERO",            ErrorCode::ERR_DIVIDE_BY_ZERO },    };    class InspectErrorHandler    {    public:        InspectErrorHandler(void);        ~InspectErrorHandler(void);        nsMAGIC1::enLanguageSelection GetLanguageSelection() const { return _languageSelection; };        void SetLanguageSelection(nsMAGIC1::enLanguageSelection val) { _languageSelection = val; };        void ReadLanguageSelectionSetting(void);        bool ReadLanguageTxtFile(const string &fileName);            void GetErrorMessage(const ErrorCode errorId, string &errMsg);        void PopulateErrrCodeStringMap(void);        ErrorCode ConvertString2EnumErrorCode(const string &errorCodeString);    private:        nsMAGIC1::enLanguageSelection _languageSelection;        map<string, ErrorCode> _mapErrorCodeString;        map<ErrorCode, string> _mapErrIDToErrMsg;     };}#endif




错误信息:
error C2143: syntax error : missing '}' before 'constant'
error C2143: syntax error : missing ';' before '}'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ';' before identifier '_strErrorCode'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ';' before identifier '_enumErrorCode'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2078: too many initializers
error C2825: 'ErrorCode': must be a class or namespace when followed by '::'
error C2589: 'constant' : illegal token on right side of '::'
error C2143: syntax error : missing '}' before '::'
error C2143: syntax error : missing '}' before '::'
error C2143: syntax error : missing ';' before '::'
error C2059: syntax error : '::'
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : '}'
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','


error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
error C2059: syntax error : ','
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : '}'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '&'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ',' before identifier 'errorId'
error C2146: syntax error : missing ';' before identifier 'ConvertString2EnumErrorCode'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2143: syntax error : missing ',' before '&'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
warning C4183: 'ConvertString2EnumErrorCode': missing return type; assumed to be a member function returning 'int'
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';'
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';'
error C2059: syntax error : '}'
error C2143: syntax error : missing ';' before '}'
error C2059: syntax error : '}'


[解决办法]
路径正确吗

读书人网 >C++

热点推荐