I am declaring a structure in an header file. This file will be imported in every other file. The structure will be used in all the files.
I am facing following errors "C1067: Object is missing decl specifies" andC 2450 Expected :
I have tried all the permutation and combination for declaring this structure but I still get this error. I have checked my syntax many times and I am not finding any error.
I have noticed that not only srtucture but also variable declared as extern are giving me the same error.
Thank You.
Hello
Did you consider generating the preprocessor output and checking how the structure gets defined there?
There might be some macro some place, which generates the trouble.
CrasyCat
CrasyCat,
Can you guide me through the process or provide some refence document.
My code was working fine then suddenly I started facing this error!
Thank You.
Hello
In order to check preprocessor output:
- Click right on the name of the .c file generating the issue in project window
- In the drop down menu select preprocess.
- A new window is opened showing preprocessor listing. Search for the structure definition in there.
The syntax problem is probably arising before the structure definition.
CrasyCat
CrasyCat,
As you instructed I checked the preprocessor output: for my project.
extern struct{ unsigned char unit : 1; unsigned char audio : 1; unsigned char memPointer1; unsigned char memPointer2; unsigned char memStatus; float alCount; float DoCount;} prjData;typedef struct Prj{ unsigned char unit : 1; unsigned char audio : 1; unsigned char memPointer1; unsigned char memPointer2; unsigned char memStatus; float alCount; float DoCount;};
In the first type of declaration I get the errors "C1067: Object is missing decl specifies" and C 2450 Expected ;
For second type of declaration I get errors "C 1009 Invalid redeclaration of <structure-name>" "C1067: Object is missing decl specifies" and "C 2450 Expected ;"
I have thoroughly checked my project the structure name is no redeclared.
Hello
The portion of code you have provided can be compiled without any trouble with CW MCU V10.2.
There should be a problem some other place.
If you are not able to locate the problem with the preprocessor listing, please submit a service request for that.
Click here to submit a service request.
Make sure to attach a reproducible project and installed product information to the service request.
CrasyCat