Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redeclaration Errors

Status
Not open for further replies.

crmayer

Programmer
Nov 22, 2002
280
US
I am getting redeclaration error on a function and I can not see any difference inbetween the two. I am also getting 2 ohter errors that I have never seen before:

Prototype for function draw_tractors cannot contain "..." when mixed with nonprototype declaration.

Prototype for function draw_tractors must contain only promoted types if prototype and nonprototype declaration are mixed.

The two functions look like this:

draw_tractors(i_tractors[x].tr_no, pmclat, pmclon,
currlat, currlong);
AND
int draw_tractors(char *ln, float lat, float lon,
float actlat, float actlong)
Any ideas as to what might be wrong or what I might look for to fix thes compilation errors?
 
hi,
which type is the "tr_no" of the i_tractors array of struct?

bye
 
This may be a typical case of Miranda - if you don't provide a prototype, one will be provided for you.

1) Is there a forward prototype declaration of draw_tractors? If you don't provide one, the compiler will provide one for you based on the parameters. If these are not the same as the declaration of the function when the compiler finally arrives at it, the compiler will start moaning.
2) Is one of the parameters in

draw_tractors(i_tractors[x].tr_no, pmclat, pmclon,
currlat, currlong);

a const value?
 
tr_no is type char[7].

As far as the const value, no. None of the values are constants. I do get a couple of other errors telling me that it is going to have to convert my float values to double.

Can I ask what a forward prototype delclaration is?
 
Just make sure

int draw_tractors(char *ln, float lat, float lon,
float actlat, float actlong);

appears somewhere in the code before you use it. It is just a signature of what it looks like otherwise the compiler will invent its own. It may have invented

int draw_tractors(char ln[7], float lat, float lon,
float actlat, float actlong);

which may be why it is moaning.

 
Thank you.

I declared the function at the top of the program and all it good. I guess I did not realize that if the compiler ran into the function call before the function itself it would act like that.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top