Syntax

C Compile with GCC Syntax

In C, compile with gcc: compiles a C file into a program — gcc main.c -o main

Quick Answer

Syntax
gcc main.c -o main
CSyntax

Compile with GCC

Code example
gcc main.c -o main

Compiles a C file into a program.

Learn More

How to compile with gcc in C

  1. Open your C file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C Compile with GCC Syntax

Use gcc main.c -o main.

Related Syntax References

Frequently asked questions

What is the C syntax for compile with gcc?

Use this pattern: gcc main.c -o main

Can I copy this C code example?

Yes. Use Copy code and adapt the example to your program.

Is this C syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify