I have a confusion with the way #include
directives work in C/C++
. My first question is:
If header A includes header B first and then header C, is everything defined in header B immediately available in header C ? e.g:
/* FILE: header A */
#include "B.h"
#include "C.h" //are stuff from B.h available INSIDE C.h now?
My second question is (somewhat related to above) is this inclusion behavior different in C and C++?
Lastly, I am trying to compile freeglut
with a C++ compiler and freeglut
's header has the following:
#ifndef __FREEGLUT_H__
#define __FREEGLUT_H__
#include "freeglut_std.h"
#include "freeglut_ext.h"
#endif /* __FREEGLUT_H__ */
Problem is that, under compilation as C, everything is fine but switching to C++ in Visual Studio suddenly makes freeglut_ext.h
to be unaware of everything defined in freeglut_std.h
. Is this an issue limited to MSVC?