Warning: ISO C prohibits empty translation unit

In the header file, I have the following code that gives me an error in the header when trying to link.

#ifndef BOOLEAN_H #define BOOLEAN_H #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif #endif indicating the error occurs in the line of the last #endif 
+5
source share
1 answer

When compiled with -pedantic reports diagnostics when the translation unit is empty because it is requested by the C standard. To make gcc happy, you can add a dummy typedef to the empty .c file:

 typedef int make_iso_compilers_happy; 

or

 extern int make_iso_compilers_happy; 
+14
source

Source: https://habr.com/ru/post/1205411/


All Articles