CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Function Prototyping

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jim C Ashby



Joined: 08 Nov 2005
Posts: 5

View user's profile Send private message Visit poster's website MSN Messenger

Function Prototyping
PostPosted: Wed Nov 09, 2005 10:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 09, 2005 11:11 am     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Wed Nov 09, 2005 11:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 09, 2005 12:26 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Wed Nov 09, 2005 2:56 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group