PSSGCSim
PSSGCSim

Reputation: 1287

C++ global includes

Is there any way how include all neaded things just by one .h file ? (When I made try I get really lot of errors ...)

There is a small example of my meaning:

Upvotes: 1

Views: 4663

Answers (2)

PersianGulf
PersianGulf

Reputation: 2935

It's very useful and avoid to circular include :

Soppose you have x.h : in head of x.hYou should define :

#ifndef X_H
#def X_H

///CODE of x.h

#endif X_H

Then you should create a includes.h and according to dependencies , include your header files in includes.h

Finally: Every where you want to include each files you only do :

#include "includes.h"

Upvotes: 3

PSSGCSim
PSSGCSim

Reputation: 1287

I have found where the problwm was. If you're using global include file it can't contain includes for sub-includes which defines class and vars. Like if you want in main use someting from test you can't put test.h include to includes.h ...

Upvotes: 0

Related Questions