Sunday, July 12, 2009

How to include all files from another folder using C++?

Is there any way to use #include to include all the files from other folders so you don't have to use #include so much

How to include all files from another folder using C++?
I am not sure if this is what you want, but you could make a header file that includes all or most of the includes you want, and just do one include of the new header file.


eg,


// new_header.h


#include %26lt;other_1.h%26gt;


#include %26lt;other_2.h%26gt;


#include "mine_1.h"


etc





then


#include "new_header.h"


in your file
Reply:Yah listen to jack573 he got the right idea, try that.
Reply:You need to create a header that refrences all files you want to include,





just make sure that you also place





#pragma once at the top of every file so that it won't get included more than once.





you can also use





#ifndef __FILE_NAME__


#define __FILE_NAME__





header file here





#endif





instead of #pragma once as it is more standards compliant


No comments:

Post a Comment