Go to Post How many computer programmers does it take to screw in a lightbulb? Woah, no. That's a hardware problem. - jordie228 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 04-02-2005, 13:48
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
syntax error using enum{}

When I compile my code, the compiler says "syntax error" for one of my header files and points to the line shown below:

Code:
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:

Code:
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:


Code:
#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
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Routine declaration syntax error (Or: Where's wlado?) Astronouth7303 Programming 15 24-03-2004 05:51
BS2 syntax (PBASIC) on the new controllers? Maybe! Jeremy_Mc Programming 0 25-10-2003 15:00
PBASIC Syntax Question Raven_Writer Programming 4 20-08-2003 08:07
PBASIC language syntax WizardOfAz Programming 14 30-04-2003 10:23
UltraEdit Syntax Highlighting Jeff McCune Programming 9 19-01-2003 20:08


All times are GMT -5. The time now is 00:01.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi