包含目录中的所有文件?
如何实现以下代码所要实现的功能?
How can one achieve what the following code is trying to do?
#include "dir/*"
推荐答案
在 Bash 中:
HEADER=all_headers.h
echo "#ifndef __ALL_HEADERS__" > $HEADER
echo "#define __ALL_HEADERS__" >> $HEADER
for file in dir/*.h
do
echo "#include <$file>" >> $HEADER
done
echo "#endif" >> $HEADER
相关文章