|
|
View previous topic :: View next topic |
Author |
Message |
DireSpume
Joined: 07 Jan 2013 Posts: 31
|
Passing struct by value doesn't work |
Posted: Mon Jan 14, 2013 3:38 pm |
|
|
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
|
|
Posted: Mon Jan 14, 2013 4:42 pm |
|
|
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
|
|
Posted: Mon Jan 14, 2013 4:48 pm |
|
|
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. |
|
|
|
|
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
|