インクルードガード

test.h

#ifndef DEBUG
        #define DEBUG
        #include "test.h"
#endif

#include "test.h"

#define AAA 256

test.c

#include <stdio.h>
#include "test.h"

int main(void)
{
    printf("%d\n", AAA);

    return 0;
}

実行すると、test.h が無限にインクルードを繰り返しコンパイルできない。

test.h の中に、入れ子になっている #include “test.h” を削除してやるとうまくいく。