[Solved] #define to include header file c++


#include "header.h"

This is replaced by the compiler with the code of header.h.

#define header

This just defines a ‘mark’ (not sure how to call it). It can be used in some code like that

#ifdef header 
    puts("It is defined!");
#else
    puts("Oh no!");
#endif

The underscores can be used in a variable’s names and also in the defines. They don’t have any meaning except the fact that many functions used in system libraries start with an underscore. So, writing a function called _exit will lead to lots of problems as there is an important system call called like this.

If define works like include in your case, than I can guess your compiler’s drunk or you have #include "header.h" somewhere else in your code.

0

solved #define to include header file c++