 | Discussion Forum |  |
|
|
I meet the problem : 5623.H(4): error C129: missing ';' before 'data'Next Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author alan wang Posted 12-Oct-2005 12:14 GMT Toolset C51 |  I meet the problem : 5623.H(4): error C129: missing ';' before 'data' alan wang //5623.h extern DEVICE_REQUEST data ep0_cmd;
//usb.h typedef struct { /* */ }DEVICE_REQUEST;
//define.c DEVICE_REQUEST data ep0_cmd _at_ 0x18 = {0};
Build target 'Target 1' compiling main.c... 5623.H(4): error C129: missing ';' before 'data' compiling motor.c... 5623.H(4): error C129: missing ';' before 'data' compiling scsi.c... 5623.H(4): error C129: missing ';' before 'data' compiling usb.c... 5623.H(4): error C129: missing ';' before 'data' compiling define.c... 5623.H(4): error C129: missing ';' before 'data' Target not created | | Read-Only Author erik malund Posted 12-Oct-2005 12:59 GMT Toolset C51 |  RE: I meet the problem : 5623.H(4): error C129: missing ';' before 'data' erik malund I guess DEVICE_REQUEST is not defined in the modules that show the error
Erik | | Read-Only Author Walter Conley Posted 12-Oct-2005 13:17 GMT Toolset C51 |  RE: I meet the problem : 5623.H(4): error C129: missing ';' before 'data' Walter Conley I'm guessing that this also applies.
http://www.keil.com/support/docs/937.htm | | Read-Only Author Dan Henry Posted 12-Oct-2005 13:19 GMT Toolset C51 |  RE: I meet the problem : 5623.H(4): error C129: missing ';' before 'data' Dan Henry DEVICE_REQUEST must be known to the compiler before the extern declaration in 5623.h, so either 5623.h must include usb.h before the declaration or main.c must include usb.h before including 5623.h. | | Read-Only Author Hans-Bernhard Broeker Posted 12-Oct-2005 14:49 GMT Toolset C51 |  RE: I meet the problem : 5623.H(4): error C129: missing ';' before 'data' Hans-Bernhard Broeker so either 5623.h must include usb.h before the declaration or main.c must include usb.h before including 5623.h.
And here's one strong piece of advice: by all means, whenever remotely possibly, avoid that second choice.
Header files should always be self-contained and idempotent, i.e. their effect should not depend on anything being present or absent in the file they're getting #included in, before their #include line. The way to achieve that is this
*) if a header file references any elements defined in some other header file, it has to #include that other header
*) except for rare exceptions, every header file shall have multiple-inclusion guards, so it can be included in a single translation unit arbitrarily many times.
As a rough test, each header file you write should be compilable without errors, all by itself, and #including it 20 times in a row may not cause errors. | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|