On Jul 21, 2:06*am, Lee <l...@yahoo.comwrote:
mdh wrote:
>
Amazingly I faced a similar issue only yesterday .
.Then on compiling
kaboom! I have some 68 errors and warnings very similar to those you
got.
Well...I think I finally figured it out completely. It was a
combination of defining a function twice, but also of omitting a ";"
in the header file.
This header file:
void reverse( char *s);
void swap( char *s, char *t);
void swap_int(int v[], int, int);
int a_toi(char *s);
int is_space ( char c);
int is_digit(char c);
void i_toa(int n, char *s);
double a_tof (char *s) <<<<<<<<<=========
int getline(char *, int);
void unget_s(char *s);
double pop(void);
void push ( double d);
void str_cpy( char *s, char *t);
void unget_ch(char c);
int get_ch(void);
int getop(char *s, int lim);
int str_len( char *s);
produces these errors.
error: syntax error before '{' token
: error: redefinition of parameter 'str_len'
error: previous definition of 'str_len' was here
error: syntax error before '{' token
: error: parameter 't' is initialized
error: 's' undeclared (first use in this function)
error: syntax error before 'if'
error: syntax error before 'while'
error: parameter 'start' is initialized
error: syntax error before 'while'
error: storage class specified for parameter 'bufpos'
error: parameter 'bufpos' is initialized
error: 'buf' undeclared (first use in this function)
error: storage class specified for parameter 'startbuf'
: error: parameter 'startbuf' is initialized
: error: storage class specified for parameter 'endbuf'
error: parameter 'endbuf' is initialized
: error: redefinition of parameter 'unget_ch'
error: previous definition of 'unget_ch' was here
: error: syntax error before '{' token
error: storage class specified for parameter 'startstack'
: error: parameter 'startstack' is initialized
: error: 'valstack' undeclared (first use in this function)
: error: storage class specified for parameter 'posstack'
: error: parameter 'posstack' is initialized
: error: storage class specified for parameter 'endstack'
: error: parameter 'endstack' is initialized
error: redefinition of parameter 'pop'
error: previous definition of 'pop' was here
error: syntax error before '{' token
Build failed (27 errors)
Adding one semicolon, clears up all.
The only clue I can see ( probably more readily seen by the more
experienced members) is the first error which occurs here.
#include <stdio.h>
#include "krExercises.h"
int main (int argc, const char * argv[]) { /* <<<----error: syntax
error before '{' token
I guess with hindsight this should have been a clue that the header
file was the problem??
All this has to pay off someday!!! :-)