View previous topic :: View next topic |
Author |
Message |
Jim C Ashby
Joined: 08 Nov 2005 Posts: 5
|
Function Prototyping |
Posted: Wed Nov 09, 2005 10:48 am |
|
|
I just upgraded to the latest Compiler and I started getting errors that all of my function prototype were already defined.
I // out all of the function prototypes in my main C code, and the error went away.
Question: Is it no longer needed to declare function prototype as long as we use the #include command to include the various files which contain the funtions? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Nov 09, 2005 11:11 am |
|
|
Quote: |
I just upgraded to the latest Compiler and I started getting errors that all
of my function prototype were already defined. |
Were you typing in function prototypes of the CCS built-in functions?
You don't need to do that.
Were you typing in function prototypes of functions that are in the
various CCS driver files ?
You don't need to do that, either. Just #include the driver files above
main(), right after all your #use() and other pre-processor statements.
If this doesn't answer your question, then give more specific details
about the error messages. |
|
|
Jim C Ashby
Joined: 08 Nov 2005 Posts: 5
|
|
Posted: Wed Nov 09, 2005 11:28 am |
|
|
I created my own functions and placed them in my own files.
file named menu1100.c containes the funcrion menu_1100() which executes a menu system.
In my Main.c program I had in the past needed to place a function prototype suach as void menu_1100(); and place #include "menu1100.c" above the prototype all above the main() section of the code.
Once I upgraded to the lastest version, I received error messages when the void menu_1100(); was in the main.c file.
I had to remove the function prototyping, all of them. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Nov 09, 2005 12:26 pm |
|
|
Quote: |
In my Main.c program I had in the past needed to place a function
prototype such as void menu_1100(); and place #include "menu1100.c"
above the prototype all above the main() section of the code. |
Based on your explanation, I assume you're doing it as shown in the
code below. I don't know why you would have to put the function
prototype below the #include line. When the compiler loads the
include file, it's going to see the function definition. I can't see why
you would need the prototype.
Question: What previous version of the compiler were you using ?
Quote: |
#include "Temp.c" // This file has the menu_1100() function in it
void menu_1100(); // This line should not be needed
//=========================
void main()
{
menu_1100();
while(1);
} |
|
|
|
Jim C Ashby
Joined: 08 Nov 2005 Posts: 5
|
|
Posted: Wed Nov 09, 2005 2:56 pm |
|
|
I updated my maintanence contract about a month or so ago, and when I received the CDROM 3.235.23.16 it did not give me an error, only when I updated to the 3.237.7.16 version did I start getting this error.
I have resolved the problem and I do appreciate the automatic nature of the #include statement I just hope that others are aware of this issue if they have created code a long time ago and find that it no longer compiles witout errors any longer. |
|
|
|