View Full Version : syntax error in code that i have never even seen before: HELP!
so... i was working with my code... and i try to compile it again... the same way i have for about 50 times now, when suddenly a syntax error apperes. no problem right? it is probley a missing semicolon or something, except it appered in some wacked section of the code i didnt even know EXisted! Me = CONFUSED!
:ahh: :confused: :eek: :mad:
tryied fixing it, but came up with nothing... tryied cutting and pasting from defalt code, still nothing....
HELP!
here is the magical code of doom(all of it, the entire page) ( i founded it in C:mcc18\h\stdarg.h):
/* $Id: stdarg.h,v 1.2 2004/08/04 18:46:23 GrosbaJ Exp $*/
#ifndef __STDARG_H
#define __STDARG_H
(says syntax error on this line) typedef void* va_list;
#define va_start(ap,1) {(ap)=(void*)((char*)&(1));}
#define va_end(ap)
#define va_arg(ap,t) (*((t*)((ap)=((t*)ap)-1)))
#define va_copy(dst, src) ((dst) = (src))
#endif
help?
the dead line is in 2 days!! ack!!!!!!
and my code is having problems after it was working fine! (but wasnot done)
Keith Watson
19-02-2006, 23:52
Our programmer had the same problem happen yesterday. It has nothing to do with the stdarg.h file. Never touch the include files in MCC18/h/. Always assume they work.
In our case the programmer was new to declaring variables in .h files and had a syntax problem. I showed him files which had the proper syntax, he made changes to his code then it worked fine.
If you have a known timeframe of when the last build worked look for all source files with a later date.
steven114
20-02-2006, 01:36
Well, don't always assume that the header files are correct... I was having huge headaches trying to compile a line of code to set the priority of interrupt 3 (INT3IP) to 0. Turned out that the header file had misspelled it as INT3P, even though the datasheet was quite clear that it was INT3IP... That blew a couple of my hours! :/
so.... are you saying that there is a problem somewhere else in my code(very likely) and the compiler desided to put the error message here?
Mark McLeod
20-02-2006, 10:04
so.... are you saying that there is a problem somewhere else in my code(very likely) and the compiler desided to put the error message here?
Yes.
What probably happened is you introduced a syntax error, but you know how the compiler will sometimes highlight the line after an error? When it finally figures out you mistyped something? If your syntax error occurs right before an #include statement, it'll instead highlight the first line in that inoffensive include file (or one of the many nested system include files).
I've often seen it when someone accidentally hits the keyboard and unknowingly inserts a random character at the very top of one of their source files.
ROFL! the problem was a random "C" in front of a /*
me = feel stupid.........
thx!!!
Keith Watson
20-02-2006, 12:47
the problem was a random "C" in front of a /*Glad you found it. Our programmer had a similar problem. It is a common (easy) mistake caused by how the focus of the text cursor works. Make sure the text cursor is in view before any text key is pressed.
aksimhal
20-02-2006, 14:37
:cool: Great Job!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :cool:
mallot1243
24-02-2006, 12:02
I'm having the same problem, however there is no random letters before comments and after the syntax error I commented out the last bit of code (just a Get_Analog_Value). It seems weird a typedef* va_list function would be the syntax though.
Mark McLeod
24-02-2006, 12:12
Well, based on what you posted you have a typo in one of your .c files right before an #include "stdio.h"
What file is being compiled when the syntax error is reported?
Post that file.
Keith Watson
24-02-2006, 14:22
Always remember that you are smarter than the compiler.
How is something like this tracked down? A problem with a standard h file is most likely caused by a syntax error before that file is included.
Look at what files in the FRC directory include stdarg.h. None. So it has to be included from a .h file somewhere. Look in MCC18/h. It is only included by stdio.h and is the first thing in that file.
So the place to look for errors is between the start of the .c file which is not compiling and the line "#include <stdio.h>".
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.