![]() |
syntax error using enum{}
When I compile my code, the compiler says "syntax error" for one of my header files and points to the line shown below:
Code:
enumCode:
enumI did a Build All (CTRL-F10) to make sure there wasn't a leftover symbol table. No difference. As a matter of practicality I renamed all the variables to start with an _underscore, and now it builds just fine. But it bugs me that I can't explain this error. Any ideas????? Here's the entire header file: Code:
#ifndef SCRIPTING_H |
Re: syntax error using enum{}
For one, enums aren't part of the C standard (unless they were add in ISO C99). Second, you have to give the enum a name. I believe the syntax is:
enum <name> { <enum values> }; Hope this is helpful. Matt |
Re: syntax error using enum{}
Quote:
Besides, if enum{} wasn't allowed, just changing the names of the identifiers would not have eliminated the syntax error. But it did. I'm still confused. |
Re: syntax error using enum{}
Quote:
Code:
/* Command States */Quote:
|
Re: syntax error using enum{}
I think that's it. I had re-written robot.[h,c] but I think I have a residual #include "robot.h" in user_routines.c. I'll have to double check tonight, but I'm pretty sure that's it.
You'd think the compiler could have said something a little more helpful than "syntax error"... Thanks! -Norm |
Re: syntax error using enum{}
I can only agree with you about the error statement. I wasted hours trying to decipher these, while the problem was mainly as simple as giving a name to a parameter similiar to an existing macro, or ; being where it's not needed and vice versa :D
|
Re: syntax error using enum{}
That was indeed the error.
Yeah, the compiler is low on helpfulness. I accidentally created a local variable that shadowed a global variable but it gave no warning. Is there a way to increase the number of warnings for the compiler? Like gcc -Wall? |
Re: syntax error using enum{}
Quote:
Code:
enum |
Re: syntax error using enum{}
Quote:
Then on the MPLAB C18 tab, set the Diagnostic Level="Errors, Warnings, and Messages" I make no guarantee, however, that it will catch these problems. |
| All times are GMT -5. The time now is 00:01. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi