2007-09-24 02:35 AM
2007-09-17 11:30 AM
Hi folks!
I´m struggling with a weird problem: there is a struct in my code like this: extern struct { int Flags : 3; int Write : 2; int Read : 3; }TestData; Afterwards compilation, I got this error: #error clnk Debug\sugar_project.lkf:1 symbol _TestData not defined (Debug\bk.o Debug\hid.o Debug\main.o Debug\my_appli.o ) I don´t know why the compiler prompts this message. I´ve tried to declare this same struct outside (in a .c file, because it is an external struct), but in this case the message is: #error cpst7 user_var.c:122(2+8) redeclared external TestData Is my extern declaration correct? This problem is getting me headache... I´ll be very grateful for hints... Thanks Wilson2007-09-19 10:28 PM
2007-09-24 02:35 AM
Yeah, I´ve already solved it.
What I did, in summary, was declare my struct in User_var.h like this: struct _TestData{ unsigned char Flags : 3; unsigned char Write : 2; unsigned char Read : 3; }; extern struct _TestData TestData; In User_var.c it was declared suitable like this: struct _TestData TestData; After doing this, the error vanished! Thanks a lot Wilson