I'm trying to access enums from a header file in c++ and getting errors, I think I may just be approaching this in the wrong way.
When I compile the program I get errors saying my enums weren't declared in this scope.
e.g. "error: BASIC was not declared in this scope" "error: ‘PIPE’ was not declared in this scope"
tokenizer.h
typedef struct {
char *start;
enum { BASIC, SINGLE_QUOTE, DOUBLE_QUOTE, PIPE, SEMICOLON, EOL, ERROR } type;
} aToken;
simpleshell.cpp
void processLine(char *line)
{
enum { CMD, PIPED_CMD, ARGS } processMode;
processMode = CMD;
Statement *stmt = newStatement(); // Store the current statement
Command *cmd = NULL;
int doneFlag = 0;
char *expandedToken = NULL;
startToken(line);
aToken answer;
answer = getNextToken();
while (!doneFlag)
{
switch (answer.type)
{
case ERROR:
... // some code
return;
... // other case statements
case PIPE:
... // some code
break;
case EOL:
doneFlag = 1;
default:
fprintf(stderr, "Programming Error: Unrecognized type returned!!!\n");
if (cmd != NULL )
{
freeCommand(cmd);
cmd = NULL;
}
if (stmt != NULL)
{
freeStatement(stmt);
stmt = NULL;
}
return;
}
answer = getNextToken();
}
}