Reputation: 31
In my C++ code, I want to include many header files that are placed in one folder. how can i include them all at once?
Upvotes: 3
Views: 369
Reputation: 4991
Execute the following shell commands in the directory which holds your .h files:
rm -f meta.h
echo "#ifndef META_H" >> meta.h
echo "#define META_H" >> meta.h
for h in `ls *.h`; do echo "#include \"$h\"" >> meta.h; done
echo "#endif /*META_H*/" >> meta.h
...and then #include "meta.h" alone.
Upvotes: 4
Reputation: 1185
You may wrap them in a helping header file. Having created it once, you can include
it everywhere.
Upvotes: 1
Reputation: 62975
Create a header file that includes them all and include that instead.
I.e., I know of no compiler that has this functionality built in, and if one did it would certainly be non-standard functionality.
Upvotes: 11