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

error in an easy code

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







error in an easy code
PostPosted: Tue Nov 16, 2004 12:47 pm     Reply with quote

Hiii guys....

I compiled den.C file with den1.C
den1.C is clearly included in the den.C.
But I got an error such as "undefined identifier b".
when I put int b=1; in the main . It is OK.
But for this time,

I got "Can not change device type this far into the code"
What should I do?

I use 3.155 ver., MPLAB IDE ver is 6.3.
What is the reason you think?
thanks for help

// The following is the first file (den.C)

#include<16f877.h>
#include"den1.c"

main(){

int a;
a=a+b;
return 0;
}

*******

// This one is included file (den1.C)

#include<16f877.h>

int b=1;
fonk(){

return b;
}
John Morley



Joined: 09 Aug 2004
Posts: 97

View user's profile Send private message

PostPosted: Tue Nov 16, 2004 12:51 pm     Reply with quote

Hi,

If you read the error message carefully, I think your problem becomes quite obvious! Apparently the compiler does not like the fact that you have an #include<16f877.h> statement in each module. At least that is how I would interpret the "Cannot change device type this far into the code" error......

John
_________________
John Morley
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