When I compile my code, the compiler says “syntax error” for one of my header files and points to the line shown below:
enum
{
START, <== this line causes syntax error
IN_PROGRESS,
DRIVING,
TURNING,
COMPLETE
};
When I rename the variable START to something else like FOOSTART, the error moves down to the next line:
enum
{
FOOSTART,
IN_PROGRESS, <=== now the error is here
DRIVING,
TURNING,
COMPLETE
};
I figured there must be a name conflict (since I’m using bits of Kevin’s code), so I Searched in Project Files… for “IN_PROGRESS”, but it is only defined in this one place. No conflict. As I modify each variable in the list, the error moves down the list.
I did a Build All (CTRL-F10) to make sure there wasn’t a leftover symbol table. No difference.
As a matter of practicality I renamed all the variables to start with an _underscore, and now it builds just fine. But it bugs me that I can’t explain this error.
Any ideas???
Here’s the entire header file:
#ifndef SCRIPTING_H
#define SCRIPTING_H
#define MAX_SCRIPTS 32 // more than this is an error from parseScript()
struct scriptCommand
{
int command;
long int parm_1;
int parm_2;
int parm_3;
};
// List of commands
//
enum
{
S_NAME, // marks the start of a script
S_END, // marks the end of a script
S_DRIVE, // <distance>, <maxSpeed>, <maxAccel>
S_TURN, // <heading>, <maxSpeed>, <maxAccel>
S_STOP,
S_WAIT, // <counts>
S_SET_ARM_POSITION, // <angle>, <speed>, <tolerance>
S_LIST_END
};
// List of all possible command states
// Not all are used in every command.
enum
{
START,
IN_PROGRESS,
DRIVING,
TURNING,
COMPLETE
};
int parseScript();
int startScript( int scriptCode );
int executingScript( ); // returns 1 if a script is executing.
void backAndForth();
void driveFromStartToLoading();
void knockOffHangingTetra();
void setArmPosition();
unsigned char sDrive();
unsigned char sTurn();
#endif