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

undefined identifier get_long

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



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

undefined identifier get_long
PostPosted: Wed Apr 06, 2011 11:11 pm     Reply with quote

#include <16f877a.h>
//#include <protoalone.h>
//#include <stdlib.h>
//#include <input.c>
//#fuses HS,NOLVP,NOWDT
//#use delay(clock=20000000)
//#use rs232 (baud=9600,xmit=PIN_C6,rcv=PIN_C7)
//#include <16F877A.H>
//#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#fuses NOWDT,HS, NOPUT, NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

void main()
{
char gender;
long int w,h,result;

printf("\r\nBody Mass Index");
{
printf("\r\nChoose Your Gender(Male or Female):");
gender=getc();

if(gender=='M')
{
printf("\r\nInsert Your Weight(kg):");
w=get_long();

printf("\r\nInsert Your Height(m):");
h=get_long();

result=w/(h*h);

printf("\r\nYour BMI Result is %lu:",result);
}
}
why get_long error?
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 11:37 pm     Reply with quote

Is your get_long() function defined as long int?
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 11:43 pm     Reply with quote

Sid2286 wrote:
Is your get_long() function defined as long int?

yeah..i already change it to long int..but its still error
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Wed Apr 06, 2011 11:50 pm     Reply with quote

Can you show the get_long function? is your return type also long int?
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:00 am     Reply with quote

Sid2286 wrote:
Can you show the get_long function? is your return type also long int?

this program also get_long error

#include <protoalone.h>
#include <utility.c>
#include <stdlib.h>
#include <input.c>
void main()
{ long a,b,result;
char opr;
while(TRUE)
{ printf("\r\nEnter the first number: ");
a=get_long();
do
{ printf("\r\nEnter the operator (+-*/): ");
opr=getc();
printf("%c\n",opr);
} while(!isamoung(opr,"+-*/"));
printf("\r\nEnter the second number: ");
b=get_long();
switch(opr)
{ case '+' : result= a+b; break;
case '-' : result= a-b; break;
case '*' : result= a*b; break;
case '/' : result= a/b; break;
}
printf("\r\nThe result is %lu ",result);
}
}
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:02 am     Reply with quote

Sid2286 wrote:
Can you show the get_long function? is your return type also long int?

i write long w,h,result;
also get same error Crying or Very sad
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:08 am     Reply with quote

I can't see your get_long function so I cannot comment how it works!
So to check the rest of the code, I simply added
Code:

int16 get_long()
{
int16 x;
return(x);
}


to the previous code and it complies properly.

Sid
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:13 am     Reply with quote

Sid2286 wrote:
I can't see your get_long function so I cannot comment how it works!
So to check the rest of the code, I simply added
Code:

int16 get_long()
{
int16 x;
return(x);
}


to the previous code and it complies properly.

Sid

why you put int16?what function its?
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:16 am     Reply with quote

Its same as long int you can also try with
Code:

long int get_long()
{
long int  x;
return(x);
}


It still complies properly.

Sid
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:25 am     Reply with quote

Sid2286 wrote:
Its same as long int you can also try with
Code:

long int get_long()
{
long int  x;
return(x);
}


It still complies properly.

Sid

okey..also same error..
when i enable
#include <stdlib.h>
#include <input.c>
error get_long gone but error
undefined identifier putchar & getchar
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:38 am     Reply with quote

Please use in following order.

Code:

#include <16f877a.h>
//#include <protoalone.h>

//#fuses HS,NOLVP,NOWDT
//#use delay(clock=20000000)
//#use rs232 (baud=9600,xmit=PIN_C6,rcv=PIN_C7)
//#include <16F877A.H>
//#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#fuses NOWDT,HS, NOPUT, NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <stdlib.h>
#include <input.c>


It will work ;)
Sid
najhan88



Joined: 06 Apr 2011
Posts: 7

View user's profile Send private message

PostPosted: Thu Apr 07, 2011 12:40 am     Reply with quote

Sid2286 wrote:
Please use in following order.

Code:

#include <16f877a.h>
//#include <protoalone.h>

//#fuses HS,NOLVP,NOWDT
//#use delay(clock=20000000)
//#use rs232 (baud=9600,xmit=PIN_C6,rcv=PIN_C7)
//#include <16F877A.H>
//#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#fuses NOWDT,HS, NOPUT, NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <stdlib.h>
#include <input.c>


It will work ;)
Sid

wow..thnks dude Razz Razz
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