Is there a way to compile all .c
files in a given folder by using the command line with GCC compiler ?
I've seen this page for Linux : http://www.commandlinefu.com/commands/view/3230/compile-all-c-files-in-a-directory but couldn't find any equivalent for CMD.
Talking about main.o "calling functions in" module.o is perfectly fine, but an .o file is not a source file, it's a compiled object file. If "put my source code in files with extension .o " actually meant "compile my source code into files with extension .o " then the situation would make a whole lot more sense.
To produce only the compiled code (without any linking), use the -C option.
GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++.
I guess gcc itself doesn't have such a parameter.
But you can try the regular wildcard argument of gcc *.c -o Output
where the *
(wildcard) is to read as "any".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With