Hey as the title states i have a problem with mp lab and would like some assistance. I am using the FRC Code_2007_8722 and when i go to build the program i get this error message “C:\Documents and Settings\Christopher\Desktop\frc-code-2007-8722\FrcCode_2007_8722\user_SerialDrv.c:52:Error: syntax error”
and my code where te error supossively is :
"typedef DeviceStatus *DeviceStatusPtr;
//static PANEL_INPUT_RECORD dataIn; /* data input buffer (from Breaker Panel) /
static unsigned char IntState;
static panel_bitid bpFlags;
static DeviceStatus dcb[TOTAL_SERIAL_PORTS]; / device control block */
unsigned char aBreakerWasTripped;
static char rom2ramBufr[12];
" with the error arrow at the line static panel.
What do i do? help please
I’m not sure what you are trying to do here, but I have never seen anything put after a semicolon. I’m not sure if you were trying to comment out COLOR, or if it serves a purpose. May be something to look at, but I’m not guaranteeing thats the problem, so dont go to crazy with it. Hope it helps.
Joey
First, considering the length of your path to that file, you’re running perilously close to the 64 character limit for the files path for the compiler. I’d consider moving the code from your desktop to a root directory.
Second, have you previously defined DeviceStatus somewhere?
I keep mine in a folder directly on the C drive, and it seems to work.
Also, what are you doing with that last line? is that an arguement or an atempt at an array/vector, becuas eif so that may be it. I don’t know about that in this enviroment, so it may be entirely legal.
Course, the file length may be your problem anyway, so try that before anything else.
The path length limit would probably create a whole mess of error messages.
The C programming language is quite free form. You can put anything you want after a semicolon, including another command or comments. It is quite common to see these type of comments.
I cannot see any problems with your code. So that means add each line one at a time and see which one produces the error. You can facilitate that by commenting them out.
Well i tried moving the code into a folder directly in the c drive and recieved the same error message. should i try putting the lines of code in one at a time to see which one produces the error?
First off, a quick google search revealed your SVN repository, so you might want to protect that. That being said, i took a look over your source, and couldn’t find anything that looked wrong.
One problem i’ve had in the past taht’s really hard to find is line endings - Unix line endings are different from the DOS ones, and if you accidentally intermix them in a file, some compilers will start throwing fits. In the definition of PANEL_INPUT_RECORD in your header file, you have a variable of type panel_bitid, so it’s a fairly safe bet that it’s not the struct that’s causing the problem.
Make sure the original compiles “as is” for you, then start adding your modifications, compiling and checking each modification as it’s added. You’ll catch where you’ve gone wrong.
Whenever we have a syntax error in our code, and our code on the line and after the line is grammatically correct, our next step is to make sure we aren’t defining something previously defined.
Then we look at the code above it for syntax errors. For instance, if you have a line of code before that like this:
int new_variable
and forget the semicolon, then it will cause the error on the next line following. Same goes for braces and brackets, etc.
The only other thing i can think of is that the typedef is inside a function, which causes problems.