c*******9 发帖数: 6411 | 1 I try to compile multiple c files, and would like the object files ouptut in
the same directory
gcc -c -o /user/ouput -c *.c
but does not seem to work, is there an option in gcc to specify that?
in visual c++, i can use /fo option to specify a folder for ouput, anything
similar in gcc?
thanks | d****n 发帖数: 1637 | 2 in Makefile
you can do
obj/%.o: src/%.c
[ Tab here ]gcc $(CFLAGS) -c $? -o $@
also you can do it in linux shell
mkdir -p obj
for i in *c; do gcc -c $i -o obj/`basename $i|sed 's/.c$/.o/g'`;done |
|