Checking whether #include is already declared

Viewed 22225

I am trying to check whether an #include <file.h> has already been declared using C++ macro.

Example

In file.h I do:

#ifndef FILE.H
#define FILE.H
class A
{
  //do routines 
};
#endif

In a second file called second.h I want to check if file.h has been included already.

Typical psuedo-code:

#ifndef "file.h"
#include "file.h"
#endif

#ifndef SECOND.H
#define SECOND.H
class second
{
  //do routine
};
#endif

I have tried a few #ifndef directives but no joy. Do anyone know how to achieve this?

5 Answers
Related