View Full Version : PROGRAMMING PROBLEM HELP!
Chris1228
07-01-2008, 21:44
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; [/COLOR]
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
Laaba 80
07-01-2008, 21:52
static panel_bitid bpFlags; [/COLOR]
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
Chris1228
07-01-2008, 22:01
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];
"sorry that color part was a typo" see anything else wrong? i really need 2 fix this problem
Kevin Sevcik
07-01-2008, 22:16
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?
Chris1228
07-01-2008, 22:22
ok so where should i move the code to?
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.
:)
jdejoannis
07-01-2008, 22:37
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.
/Jason
Chris1228
07-01-2008, 22:42
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?
Chris1228
07-01-2008, 22:43
And none of my programs will build is that a problem with mp lab?
Mark McLeod
08-01-2008, 10:11
Since you've modified the default code it is probably something earlier that caused the error you're seeing.
Try compiling an original version of the default code and get that working first.
Jon Stratis
08-01-2008, 11:12
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.
Chris1228
08-01-2008, 19:37
so what should i do? i dont have anyother variation of a default code
Mark McLeod
09-01-2008, 11:58
Use the original released by IFI: http://www.ifirobotics.com/docs/frc-code-2007-8722.zip
The code snippet you posted earlier shows a line commented out, so it's been modified from the original.
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.
ubergeek5075
09-01-2008, 12:19
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.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.