开发者

Feed gcc various tiny programs?

I need to compile various different tiny programs. (One program per .c file.) Currently I wrote a simple shell script that finds all the .c files and runs gcc开发者_JAVA百科 on each of them. Is it possible to run gcc once and feed it the .c files, instead of running and stopping gcc again and again like this shell script does ?

find "/home/myuser/myfolder" -name "*.c" -type f |
while read filename
do
    case $filename in
        *.c)        gcc $filename -o $var ;;
    esac
done


No. You can only compile one program/module at a time.


You need to run gcc for each file you want to compile and not one for all. If you include multiple c files to gcc it will try to link them all which isn't what you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜