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

Passing struct by value doesn't work

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



Joined: 07 Jan 2013
Posts: 31

View user's profile Send private message

Passing struct by value doesn't work
PostPosted: Mon Jan 14, 2013 3:38 pm     Reply with quote

First off, I am using the PCH compiler, version 4.140, targeted for the PIC18F67K22.
So my problem is that the following code snippet does not compile and I can't seem to figure out why. It's probably something stupid, but I guess I need help. The compiler generates several errors, the first two of which are:
- Z:\Projects\Aqua Access\MPLABXProjects\blink.X\main.c:16:201: Info#300 More info: First Declaration of NTime
- Z:\Projects\Aqua Access\MPLABXProjects\blink.X\main.c:16:214: Error#31 Identifier is already used in this scope

Code:

typedef struct {
   uint32_t Ms;
   uint32_t Of;
} NTime;

void NTimeSet(NTime* ntime, NTime pnew) {
   *ntime = pnew;
}

void main() {
   while (TRUE) {
     output_high(PIN_B6);
     delay_ms(500);
     output_low(PIN_B6);
     delay_ms(500);
   }
}


Thanks for any help! (And please, let's not discuss the foolishness of passing structs by value. I'm not necessarily going to do it this way, but I should be able to! (right?)). Incidentally, other than the #includes, this is the only code in main.c (with no other source files being included).
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 14, 2013 4:42 pm     Reply with quote

The compiler has certain quirks and one of them is that its not
case sensitive by default. To fix the current problem, add the
#case directive to your program.
DireSpume



Joined: 07 Jan 2013
Posts: 31

View user's profile Send private message

PostPosted: Mon Jan 14, 2013 4:48 pm     Reply with quote

Thanks so much, you are quite right, that was the problem. And may I just say, C has always been case sensitive, so WTF? Thanks again.
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