This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

#if & #error giving C322 Error - enum not defined?

Hi

Here is the code I have problems with
I an just starting to use this C compiler
Have used many others, mainly closer to C99

#define Num_LANGUAGEs 6


enum _LANGUAGE {
	eUSING_LAN_START = -1,	// This is always the First item
	eUSING_ENGLISH,
	eUSING_ITALIAN,
	eUSING_FRENCH_Can,
	eUSING_LAST_LANG	// This is always the Last item
};

#if Num_LANGUAGEs != eUSING_LAST_LANG
#error "Warning Not enough Lang defined"
#endif


Where is a list of C Compiler error defs(Not in manual)?

Manual poor on #if conditionals, where can I find more info?

Where is "cosf" function, for faster math?
Where is source for Libraries?

Parents
  • Hi Ralph,

    Since I've been using Keil's C166 toolset for some time now, I'll try to answer some of the questions.

    Where is a list of C Compiler error defs(Not in manual)?

    You must have looked in the wrong manual. The one you need is Keil\C166\hlp\C166.PDF
    It's also available online:
    http://www.keil.com/support/man/docs/c166/c166_er_reference.htm

    Manual poor on #if conditionals, where can I find more info?

    Not sure what you mean by that. As always, info on the C programming language is found in various books, some of which are suggested in the C166 manual:
    http://www.keil.com/support/man/docs/c166/c166_in_books.htm

    Where is "cosf" function, for faster math?

    To the best of my knowledge, the cosf function was introduced in the C99 standard. The ANSI C standard doesn't have it, so Keil's C166 doesn't have it either. I don't know if Keil Software plan to bring the C166 toolchain up to the C99 standard, and if yes, when that is going to happen. Some of C99's features would be useful, that's for sure.
    I think there is this compiler option that makes the compiler treat double as float. Presumably, the corresponding library binaries use float as well. Maybe that will work for you as a workaround?

    Where is source for Libraries?

    Well, I suppose Keil Software do not intend to show it to us. I wouldn't mind having it either. It would enable me to fix bugs and optimize some library routines. Ah, well...

    As for the error message you are getting, I think it is due to the fact that in ANSI C the preprocessor doesn't know about enum definitions. I think it's allowed in C99, but again, Keil's C166 is not a C99-compliant compiler.

    Regards,
    - mike

Reply
  • Hi Ralph,

    Since I've been using Keil's C166 toolset for some time now, I'll try to answer some of the questions.

    Where is a list of C Compiler error defs(Not in manual)?

    You must have looked in the wrong manual. The one you need is Keil\C166\hlp\C166.PDF
    It's also available online:
    http://www.keil.com/support/man/docs/c166/c166_er_reference.htm

    Manual poor on #if conditionals, where can I find more info?

    Not sure what you mean by that. As always, info on the C programming language is found in various books, some of which are suggested in the C166 manual:
    http://www.keil.com/support/man/docs/c166/c166_in_books.htm

    Where is "cosf" function, for faster math?

    To the best of my knowledge, the cosf function was introduced in the C99 standard. The ANSI C standard doesn't have it, so Keil's C166 doesn't have it either. I don't know if Keil Software plan to bring the C166 toolchain up to the C99 standard, and if yes, when that is going to happen. Some of C99's features would be useful, that's for sure.
    I think there is this compiler option that makes the compiler treat double as float. Presumably, the corresponding library binaries use float as well. Maybe that will work for you as a workaround?

    Where is source for Libraries?

    Well, I suppose Keil Software do not intend to show it to us. I wouldn't mind having it either. It would enable me to fix bugs and optimize some library routines. Ah, well...

    As for the error message you are getting, I think it is due to the fact that in ANSI C the preprocessor doesn't know about enum definitions. I think it's allowed in C99, but again, Keil's C166 is not a C99-compliant compiler.

    Regards,
    - mike

Children
No data