Function Prototype Error in C

Thread Starter

jegues

Joined Sep 13, 2010
733
I can't figure out why I'm getting function prototype errors as indicated in the figure when I try to compile.

I've included my FunctionPrototypes.h in main, so it should find the prototype for main there as indicated in the figure.

Why am I getting errors?
 

Attachments

cheezewizz

Joined Apr 16, 2009
82
I may be wrong here but I don't think you need to provide a prototype for main() as it's not really called by you it's just used to indicate the entry point of your program...

Also I believe printf() for htc is declared to return an unsigned char unless you're using a PIC18, but seeing as how you haven't included the appropriate header the compiler is assuming that it returns an int and is just letting you know this. Including <stdio.h> should sort that warning out... The same goes for the Abs() funtion you're using, you need the include the header that contains the declaration, possibly <stdlib.h> though don't quote me on that.
 
Last edited:

t06afre

Joined May 11, 2009
5,934
I can't figure out why I'm getting function prototype errors as indicated in the figure when I try to compile.

I've included my FunctionPrototypes.h in main, so it should find the prototype for main there as indicated in the figure.

Why am I getting errors?
Repost your code an error Messages in a readable format. This is probably schoolwork. But even so I do not mind give some help or point you in the correct direction. And I guess this will be the same for most of members at AAC. You do not have use "smart" tricks trying to cover up that you ask for help. Like hiding your code in a blurry bitmap:mad:
 

codehead

Joined Nov 28, 2011
57
I can't figure out why I'm getting function prototype errors as indicated in the figure when I try to compile.

I've included my FunctionPrototypes.h in main, so it should find the prototype for main there as indicated in the figure.

Why am I getting errors?
You don't need to declare main. It returns int. Compiler's mightily pissed ;)

Lose the prototype, and start your program with,

int main(void)...
 

t06afre

Joined May 11, 2009
5,934
The using HI-Tech C The putch() function is empty. It should be customised to suit the project at hand. Often printf() prints to a USART, but it could define stdout as being an LCD or SPI. Code to initialize the intended destination must be executed before printf() can be called. If you do not have defined your own putch() you will get an error. This may be the source of your second error
 

cheezewizz

Joined Apr 16, 2009
82
to be fair that's the error you would get (and I did get when I tried it:)), the two you can see in his attached pic are just warnings, they wouldn't halt compilation.
 
Top