找不到成员声明? 我在Eclipse中编写C++应用程序,编写一些代码时,我发现了18, 27, 41行的几个错误,而在CHYTYPE .CPP上发现了81个错误。以下是我的项目的当前代码:

找不到成员声明? 我在Eclipse中编写C++应用程序,编写一些代码时,我发现了18, 27, 41行的几个错误,而在CHYTYPE .CPP上发现了81个错误。以下是我的项目的当前代码:,c++,eclipse,C++,Eclipse,Chu type.h /******************************************************** * char_type -- Character type class * * * * Member functions: * * type -- returns the type of a character * * (

Chu type.h

/********************************************************
 * char_type -- Character type class            *
 *                          *
 * Member functions:                    *
 *  type -- returns the type of a character     *
 *      (Limited to simple types)       *
 *  is(ch, char_type) -- check to see if ch is  *
 *      a member of the given type.     *
 *      (Works for derrived types as well.) *
 *******************************************************/
class char_type {
    public:
        enum CHAR_TYPE {
            C_EOF,      // End of file character
            C_WHITE,    // Whitespace or control character
            C_NEWLINE,  // A Newline character
            C_ALPHA,    // A Letter (includes _)
            C_DIGIT,    // A number
            C_OPERATOR, // Random operator
            C_SLASH,    // The character '/'
            C_L_PAREN,  // The character '('
            C_R_PAREN,  // The character ')'
            C_L_CURLY,  // The character '{'
            C_R_CURLY,  // The character '}'
            C_SINGLE,   // The character '\''
            C_DOUBLE,   // The character '"'
            // End of simple types, more complex, derrived types follow
            C_HEX_DIGIT,    // Hexidecimal digit
            C_ALPHA_NUMERIC // Alpha numeric
        };
    private:
        static enum CHAR_TYPE  type_info[256];      // information of each character

        // Fill in a range of type info stuff
        void fill_range(int start, int end, CHAR_TYPE type);
    public:
        char_type();    // Initialize the data
            //~char_type -- default destructor

            // Returns true if character is a given type
            int is(int ch, CHAR_TYPE kind);

            CHAR_TYPE type(int ch);
        }
Chu type.cpp

/********************************************************
 * ch-type package                  *
 *                          *
 * The class ch_type is used to tell the type of    *
 * various characters                   *
 *                          *
 * The main number functions are:           *
 *  is -- True if the character is the indicated    *
 *      type.                   *
 *  type -- Return type of character.       *
 *******************************************************/
#include <iostream>
#include <assert.h>

#include "ch_type.h"

// Define the type information array
char_type::CHAR_TYPE char_type::type_info[256];
/********************************************************
 * fill_range -- fill in a range of types for the   *
 *  character type class                *
 *                          *
 * Parameters                       *
 *  start, end -- range of items to fill in     *
 *  type -- type to use for filling         *
 *******************************************************/
void char_type::fill_range(int start, int end, CHAR_TYPE type)
{
    int cur_ch;

    for (cur_ch = start; cur_ch <= end; ++cur_ch) {
        assert(cur_ch >= 0);
        assert(cur_ch < sizeof(type_info)/sizeof(type_info[0]));
        type_info[cur_ch] = type;
    }
}

/*********************************************************
 * char_type::char_type -- initialize the char type table*
 ********************************************************/
char_type::char_type()
{
    fill_range(0, 255, C_WHITE);

    fill_range('A', 'Z', C_ALPHA);
    fill_range('a', 'z', C_ALPHA);
    type_info['_'] = C_ALPHA;

    type_info['!'] = C_OPERATOR;
    type_info['#'] = C_OPERATOR;
    type_info['$'] = C_OPERATOR;
    type_info['%'] = C_OPERATOR;
    type_info['^'] = C_OPERATOR;
    type_info['&'] = C_OPERATOR;
    type_info['*'] = C_OPERATOR;
    type_info['-'] = C_OPERATOR;
    type_info['+'] = C_OPERATOR;
    type_info['='] = C_OPERATOR;
    type_info['|'] = C_OPERATOR;
    type_info['~'] = C_OPERATOR;
    type_info[','] = C_OPERATOR;
    type_info[':'] = C_OPERATOR;
    type_info['?'] = C_OPERATOR;
    type_info['.'] = C_OPERATOR;
    type_info['<'] = C_OPERATOR;
    type_info['>'] = C_OPERATOR;

    type_info['/'] = C_SLASH;
    type_info['\n'] = C_NEWLINE;

    type_info['('] = C_L_PAREN;
    type_info[')'] = C_R_PAREN;

    type_info['{'] = C_L_CURLY;
    type_info['}'] = C_R_CURLY;

    type_info['"'] = C_DOUBLE;
    type_info['\''] = C_SINGLE;
}

int char_type::is(int ch, CHAR_TYPE kind)
{
    if (ch == EOF) return (kind == C_EOF);

    switch (kind) {
        case C_HEX_DIGIT:

            assert(ch >= 0);
            assert(ch < sizeof(type_info)/sizeof(type_info[0]));

            if (type_info[ch] == C_DIGIT)
                return (1);

            if ((ch >= 'A') && (ch <= 'F'))
                return (1);
            if ((ch >= 'a') && (ch <= 'f'))
                return (1);
            return (0);
        case C_ALPHA_NUMERIC:
            assert(ch >= 0);
            assert(ch < sizeof(type_info)/sizeof(type_info[0]));

            return ((type_info[ch] == C_ALPHA) ||
                (type_info[ch] == C_DIGIT));
        default:
            assert(ch >= 0);
            assert(ch < sizeof(type_info)/sizeof(type_info[0]));

            return (type_info[ch] == kind);
        }
};
/********************************************************
*ch型包装*
*                          *
*类Chu类型用于说明*
*各种字符*
*                          *
*主要的数字功能有:*
*is——如果字符是指定的字符,则为True*
*类型*
*type——返回字符的类型*
*******************************************************/
#包括
#包括
#包括“Chu type.h”
//定义类型信息数组
字符类型::字符类型字符类型::类型信息[256];
/********************************************************
*fill_range——为*
*字符类型类*
*                          *
*参数*
*开始,结束--要填写的项目范围*
*type--用于填充的类型*
*******************************************************/
无效字符类型::填充字符范围(整数开始、整数结束、字符类型)
{
国际货币基金组织;
对于(cur_ch=开始;cur_ch=0);
断言(cur_ch=0);
断言(ch='A')&&(ch='A')&&(ch=0);
断言(ch=0);
断言(ch
我做错了什么?如何修复这些错误

这是我的错误消息:

说明资源路径位置类型

未找到成员声明ch_type.cpp/stats第18行语义错误


首先,在类定义之后必须插入

class char_type {
    ...
}; //HERE

其次,要使用宏
EOF
,必须首先包括

,在类定义之后必须插入

class char_type {
    ...
}; //HERE

第二,使用宏<代码> EOF必须包含>/Calp>

以提高您在StActObjt上的经验。我建议您避免与其他用户进行讨论。而且,每次您得到编译错误时,在您的问题中提供这些错误,这将使谁更容易帮助您。<代码> <代码>不是C++标准库HEA。Bartek:<代码> <代码>是一个标准的C++库头。@ BaltkkBaAcEnWiCZ编辑到CSTIDOOH谢谢。在这次对话中,你是唯一有建设性的人。为了提高你在StActOp溢出上的经验,我建议你避免与其他用户讨论。而且,每次你得到编译错误时,都要在你的问题中提供THI。S将使谁更容易帮助你。<代码> <代码>不是C++标准库头。@ Bartek:<代码> <代码>是标准的C++库标题。@ BaltkkBaAceWiCz编辑到CSTIDOOH谢谢。你是唯一一位在这段对话中有建设性的人。<代码> <代码>注释在这个答案下退化为纯噪声,并有随后被删除。请将评论集中在主题上,最重要的是专业。只是想知道,你知道你在使用哪个编译器吗?是的,我正在使用gcc@AndréPuel
此答案下的评论退化为纯噪音,并随后被删除。请将评论集中在主题上,最重要的是专业专业。只是想知道,你知道你在用哪个编译器吗?是的,我在用gcc@AndréPuel