Use of undeclared identifier 'true' Use of undeclared identifier 'true' c c

Use of undeclared identifier 'true'


The identifier true is not declared by default. To use it, two solutions :

  1. Compile in C99 and include <stdbool.h>.
  2. Define this identifier by yourself.

However, the infinite loop for (;;) is often considered as better style.


C has no built-in boolean types. So it doesn't know what true is. You have to declare it on your own in this way:

#define TRUE 1#define FALSE 0[...]while (TRUE) {     [...]}


Include stdbool.h to use C99 booleans.
If you want to stick with C89 define it yourself:

typedef enum{    true=1, false=0}bool;