Log in

View Full Version : Routine declaration syntax error (Or: Where's wlado?)


Astronouth7303
22-03-2004, 20:04
:confused: Here's a stumper:


char Autonomous_1 (char State) // <---Right Here!
{
//...
}


The error is a syntax error. It is the only error in the listing, and it is at that line. I have removed 1 or 2 routines, and still get it.

Greg Ross
22-03-2004, 20:10
That looks OK on cursory examination. What comes right before that line? Is it possible you have unmatched braces?

fred
22-03-2004, 20:12
a lot of times, it will give you a syntax error and the real error will be 10 lines up from the little green arrow.

Astronouth7303
22-03-2004, 20:12
That looks OK on cursory examination. What comes right before that line? Is it possible you have unmatched braces?
#include "printf_lib.h"


/************************************************** *****************************
* FUNCTION NAME: PrintRamString
* PURPOSE: Run 1 loop for autonomous mode 1
* CALLED FROM: anywhere
* ARGUMENTS:
* Input: char State - What is the state of atuonomous
* RETURNS: char - is it finished?
************************************************** *****************************/

Astronouth7303
22-03-2004, 20:14
The only thing above it is comments and #includes

Greg Ross
22-03-2004, 20:25
Have you modified printf_lib.h?

Astronouth7303
22-03-2004, 20:33
Have you modified printf_lib.h?
Some. Mostly just a #endif at the end.

Greg Ross
22-03-2004, 20:43
I added/************************************************** *****************************
* FUNCTION NAME: PrintRamString
* PURPOSE: Run 1 loop for autonomous mode 1
* CALLED FROM: anywhere
* ARGUMENTS:
* Input: char State - What is the state of atuonomous
* RETURNS: char - is it finished?
************************************************** *****************************/

char Autonomous_1 (char State) // <---Right Here!
{
//...
}

right after a #include of our stock printf_lib.h. No error. How about if you post your printf_lib.h?

Astronouth7303
22-03-2004, 20:46
/************************************************** *****************************
* FILE NAME: printf_lib.h
*
* DESCRIPTION:
* This is the include file which corresponds to printf_lib.c
*
* USAGE:
* If you add your own routines to that file, this is a good place
* to add function prototypes.
************************************************** *****************************/
#ifndef __printf_lib_h_
#define __printf_lib_h_

int printf(rom const char *format, ...);

void printid(int data,int crtOn);
void printb(unsigned char data,int crtOn);
void printd(unsigned char data,int crtOn);
void printix(int data,int crtOn);
void printx(unsigned char data,int crtOn);
void debug_print(char *bufr,int data);
void debug_printb(char *bufr,unsigned int data);
void debug_println(char *bufr);

#endif

/************************************************** ****************************/
/************************************************** ****************************/
/************************************************** ****************************/
Commenting out the last few declares don't help.

Greg Ross
22-03-2004, 21:07
Well, you might be right. I'm still stumped. You didn't do something weird like #defining char, Autonomous_1 or State, did you? (Or parentheses or underscores, taking a lesson from those obfuscated C samples posted elsewhere?)

Ryan M.
23-03-2004, 06:00
I'm stumped too... :)

Alan Anderson
23-03-2004, 11:30
Since you have an #ifdef/#endif protecting your printf_lib.h from being included multiple times, I suspect the problem is being caused by the line(s) before that #include. Post a bit more context, and look at the other included files for unmatched parentheses or braces or even missing semicolons.

Astronouth7303
23-03-2004, 11:46
After 3 of us working on 4 computers last night to get it to compile, we got it to compile. There were various similar problems throughout the new stuff. I have to ask: Is there a limit on the number af function prototypes in a file?

Greg Ross
23-03-2004, 12:27
Is there a limit on the number af function prototypes in a file?
Possible. How many did you have?

steven114
23-03-2004, 22:04
Is there some reason why you can't use the stock printf lib if it works? If you can't, try remodifying it one change at a time to see what it is.

Ryan M.
24-03-2004, 05:51
Is there some reason why you can't use the stock printf lib if it works? If you can't, try remodifying it one change at a time to see what it is.The stock printf has many limitations to it. There have been several threads about this and several substitutes have been offered. :)