I gathered a bunch of definitions from multiple third party.h files.
// my_header.h
#include "thrd_party_header1.h"
#include "thrd_party_header2.h"
#define MY_DEFINE_1 THRD_PARTY_DEFINE_1
#define MY_DEFINE_2 THRD_PARTY_DEFINE_2
//etc...
Problem is that now each class file including my_header.h
"sees" all those 3rd party includes. I don't want that. What can I do to minimize the headers used in my.cpp?
Would this work?
//my_header.h
#ifdef SEE_DEFINES
#include "thrd_party_header1.h"
#include "thrd_party_header2.h"
#endif
Then you can include my_header.h without seeing the third party headers, and when you want to see them just do
#define SEE_DEFINES
#include "my_header.h"
#undef SEE_DEFINES
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.