Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

'NULL' identifier

'NULL' identifier

Anonymous
Not applicable

'NULL' identifier is undefined

 

Four of the files in the EZ-USB & FX2 libraries (get_dscr.c get_infc.c get_strd.c get_cnfg.c) compile with the same error.

The following is the error message for the get_cnfg.c source file compilation:  *** ERROR C202 IN LINE 22 OF GET_CNFG.C: 'NULL': undefined identifier  C51 COMPILATION COMPLETE.  0 WARNING(S),  1 ERROR(S). It seems that the NULL macro that these functions use as a return value, is not defined.

What needs to be done to get these modules to compile in order to rebuild the library?

The macro NULL is defined in the stdio.h header file. This header file is included in the get_dscr.c, get_infc.c, get_strd.c, and get_cnfg.c source files. The include statement is of the form (instead of "stdio.h") which means that the compiler will search for the file on the default include path and the include path defined by the environment variable C51INC. The macro definition for NULL in stdio.h is #ifndef NULL   #define NULL ((void *) 0) #endif

Since the compiler did not complain about not being able to find stdio.h, it may be that there is another stdio.h header file in the search path that does not define the NULL macro or the get_xxxx.c files have been modified and they no longer include stdio.h header file. One could add this Macro definition to each file but it would be better to find out why it is not being defined by the header file that normally resides in C:\Keil\C51\INC.

0 Likes
945 Views