Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile all .c files in a directory using GCC compiler in CMD

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.

like image 853
SagiLow Avatar asked Nov 04 '13 10:11

SagiLow


People also ask

How do I compile multiple C files in GCC?

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.

Which command is compile C without linking using GCC compiler?

To produce only the compiled code (without any linking), use the -C option.

What is GCC in CMD?

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++.


1 Answers

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".

like image 189
dhein Avatar answered Oct 05 '22 06:10

dhein