Cでインクルージョンサイクルを防ぐにはどうすればよいですか? すなわち。ah #include "bh"、#include の "ch"、#include の "ah" は使用しないでください。ある種の C ディレクティブを使用して、これが起こらないようにする方法を探しています。
私は当初、これがこれを防ぐと思っていました:
ああの内容:
#ifndef __A_H
#define __A_H
#include "b.h"
#endif // __A_H
bh の内容:
#ifndef __B_H
#define __B_H
#include "c.h"
#endif // __B_H
chの内容:
#ifndef __C_H
#define __C_H
#include "a.h"
#endif // __C_H
しかし、うまくいかないようです。