I'm trying to print functions name with __func__ macro in a 8051 project.
But when I build on Keil, It has an error like this:
main.c(50): error C202: '__func__': undefined identifier
have any macro others similary? Please help me solves it.
CodePudding user response:
As the documentation says, the Keil C51 compiler does not support this macro, and apparently no other of similar functionality:
The Cx51 Compiler provides the following predefined constants you may use in preprocessor directives and C code to create portable programs.
Constant Description __C51__Version number of the compiler (for example, 701 for version 7.01). __CX51__Version number of the compiler (for example, 701 for version 7.01). __DATE__Date when the compilation was started in ANSI format (month dd yyyy). __DATE2__Date when the compilation was started in short form (mm/dd/yy). __FILE__Name of the file being compiled. __LINE__Current line number in the file being compiled. __MODEL__Memory model selected:
0 for SMALL,
1 for COMPACT,
2 for LARGE.__TIME__Time when the compilation was started. (Format: hh:mm:ss) __STDC__Defined to 1 to indicate full conformance with the ANSI C Standard.
