P-A P-A - 9 months ago 36
C Question

How to run C/C++ in a Unix console/Mac terminal?

How can I run C or C++ in Unix console or a Mac terminal?

(I know it, forgets it and relearn it again. Time to write it down.)


If it is a simple single source program:

make foo

where the source file is foo.c or foo.cpp, etc.

You dont even need a makefile. Make has enough built-in rules to build your source file into an executable of the same name, minus extension.