[Solved] How to compile a simple C code with “$gcc test.c -o demo” command?


Let’s split this into parts:

  • $ is a character indicating that the shell is ready to receive a command. It is not part of the command.

  • gcc is an executable executing the GNU C compiler from the GCC toolchain.

  • test.c -o demo are arguments supplied to gcc.

The GCC toolchain is only available natively for GNU systems such as Linux. Using MinGW or CygWin you can ape its functionality, though.


Notes:

  • A nice comment, which I second, to your question by @iharob:

    Don’t use gcc test.c -o demo specially if you are a beginner, use gcc -Wall -Wextra -Werror test.c -o demo.

    The additional switches make the compiler point out more warnings.

0

solved How to compile a simple C code with “$gcc test.c -o demo” command?