Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C include guard [duplicate]

When file1.c includes inc.h (containing the include guard #ifndef INC_H) for the first time, the #define INC_H is performed. But now, when another file2.c includes the same inc.h, is the macro INC_H already defined, all it's the same story and previous definition is not propagated here?

like image 595
Cartesius00 Avatar asked Mar 03 '26 14:03

Cartesius00


1 Answers

The macro definition is not preserved between separate compilations.

like image 111
Brett Hale Avatar answered Mar 05 '26 04:03

Brett Hale