我正在尝试编写一个 shell 命令来查找和编译所有 C 程序
find . -type f -name '*.c' -exec sh -c 'gcc {} -o $(dirname {})/$(basename {} .c)' \;
就是我现在所拥有的,它实际上编译了所有 C 文件,但它也返回了这些错误。
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
我完全被困住了,任何帮助都将不胜感激。