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

Problem with function parameters

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



Joined: 22 Aug 2008
Posts: 21

View user's profile Send private message

Problem with function parameters
PostPosted: Fri Aug 22, 2008 2:01 pm     Reply with quote

Hi,
If I try to pass a 16bit integer to a function I get this message :
Error 112 "test3.c" Line 14(1,1): Function used but not defined: ... Test SCR=393

The code looks like this
>>>>>>>>>>
include <18F2525.h> // preprocessor directive that selects the chip

void Test(long); // function prototype

void main(void)
{ long a;
a= 0xffff;
Test(a);
}

void Test(x)
{
long i;
i=x;
}

<<<<<<<<<<
It is the same whether I use long or int16. The function prototype looks ok. If I replace long by int8 it works!
I'm using compiler version 4.071
What am I doing wrong?
Ttelmah
Guest







PostPosted: Fri Aug 22, 2008 2:36 pm     Reply with quote

Your prototype, needs to match your definition, and _both_need to define the variable. So:
Code:

void Test(long x); // function prototype

void main(void)
{
   long a;
   a= 0xffff;
   Test(a);
}

void Test(long x)
{
   long i;
   i=x;
}


Best Wishes
JacquesB



Joined: 22 Aug 2008
Posts: 21

View user's profile Send private message

PostPosted: Mon Aug 25, 2008 9:35 am     Reply with quote

I knew it had to be such a stupid mistake...

thanks
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