Try to compile your code normally as

gcc test.c

If you get default output file a.exe,then go for

gcc test.c -o test.exe

Answer from Sathish on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › gcc-command-in-linux-with-examples
gcc command in Linux with examples - GeeksforGeeks
October 4, 2025 - The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a warning, debugging, linking libraries, object file etc. There are different options in gcc command to allow the user to stop the compilation process at different stages.
🌐
iO Flood
ioflood.com › blog › gcc-linux-command
GCC Command Guide: How-To Compile C Code in Linux
December 12, 2023 - This command compiles the ‘filename.c’ file and outputs an executable named ‘outputfile’. ... In this example, we use the gcc command to compile the ‘hello.c’ file. The -o option is used to specify the name of the output file.
🌐
Medium
medium.com › @laura.derohan › compiling-c-files-with-gcc-step-by-step-8e78318052
Compiling C files with gcc, step by step | by Laura Roudge | Medium
February 16, 2019 - So once we compiled it, if we run this program we will only see the phrase “Hello, World” appearing. In order for our main.c code to be executable, we need to enter the command “gcc main.c”, and the compiling process will go through ...
🌐
RapidTables
rapidtables.com › code › linux › gcc.html
GCC C compiler
Compile myfile.c with optimization and link to output file execfile: $ gcc -O myfile.c -o execfile · cd · cp · ls · gcc -c · gcc -D · gcc -fPIC · gcc -g · gcc -I · gcc -L -l · gcc -o · gcc -O · gcc -Wall · cat command · cd command · cp command ·
🌐
GNU
gcc.gnu.org › onlinedocs › gcc › Invoking-GCC.html
Invoking GCC (Using the GNU Compiler Collection (GCC))
The usual way to run GCC is to run the executable called gcc, or machine-gcc when cross-compiling, or machine-gcc-version to run a specific version of GCC. When you compile C++ programs, you should invoke GCC as g++ instead.
🌐
LabEx
labex.io › tutorials › linux-linux-gcc-command-with-practical-examples-422697
Linux gcc Command with Practical Examples | LabEx
In this lab, you first learned the basics of the GCC (GNU Compiler Collection) compiler, including how to check the installed version and the common command-line options such as -c, -o, -g, -Wall, -Werror, and -O<n>. You then practiced compiling a simple C program using the gcc command, learning how to create a source file, compile it, and run the resulting executable.
Find elsewhere
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › c programming languages › how to compile a c program using the gnu compiler (gcc)
How to Compile a C Program Using the GNU Compiler (GCC)
February 19, 2026 - On Windows 10 and 11, you can use ... a C program from source code using GCC. To make sure GCC is installed, run the command gcc --version....
🌐
Stanford
web.stanford.edu › class › archive › cs › cs107 › cs107.1202 › resources › gcc
CS107 Compiling C Programs with GCC
This is just a quick overview on how to compile and run your own programs should you decide to do so without a Makefile. The simplest way to run gcc is to provide gcc a list of .c files: ... Note that you do not put header files (.h) into the gcc command: it reads in the header files as it compiles, based on the #include statements inside .c files.
🌐
Scaler
scaler.com › home › topics › gcc command in linux
gcc Command in Linux - Scaler Topics
January 1, 2024 - The GCC command in Linux, which stands for GNU Compiler Collection, is an incredibly powerful tool used primarily for compiling and debugging programs written in C, C++, and other languages.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-3.2.3 › gcc › Invoking-GCC.html
GCC Command Options - GCC, the GNU Compiler Collection
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
🌐
The Geek Stuff
thegeekstuff.com › 2012 › 10 › gcc-compiler-options
15 Most Frequently Used GCC Compiler Command Line Options
October 30, 2012 - Through this option, output at all the stages of compilation is stored in the current directory. Please note that this option produces the executable also. ... So we see that all the intermediate files as well as the final executable was produced in the output. The option -l can be used to link with shared libraries. For example: ... The gcc command mentioned above links the code main.c with the shared library libCPPfile.so to produce the final executable ‘main’.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-3.2.2 › gcc › Invoking-GCC.html
GCC Command Options
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
🌐
TutorialsPoint
tutorialspoint.com › unix_commands › gcc.htm
gcc Command in Linux
gcc stands for GNU Compiler Collection is a command used in Linux to compile programs written in C and C++ programming language. To compile a program, you simply type the gcc followed by the name of your default source file, like gcc program.c.
🌐
CS Fundamentals
cs-fundamentals.com › c-programming › how-to-compile-c-program-using-gcc
gcc Compilation Process and Steps of C Program in Linux
This tutorial explains compilation ... preprocessing, compilation, assembly, and linking. Linux command to compile C program: gcc filename.c -o filename....
🌐
Edureka
edureka.co › blog › how-to-compile-c-program-in-command-prompt
How to Compile & Run a C Program in Command Prompt?
July 23, 2024 - The command prompt has a set of steps we need to perform in order to execute our program without using a GUI compiler. In this article, we will understand how to compile and Run a C program in the command prompt. ... Run the command ‘gcc -v’ to check if you have a compiler installed.
🌐
Medium
markkevinbaltazar.medium.com › how-to-compile-link-and-build-a-c-program-using-gcc-578071c79a76
How to Compile, Link and Build a C Program Using GCC | by Mark Kevin Baltazar | Medium
March 30, 2019 - Compiling To compile, open the terminal and go to the folder where you have saved hello.c Then type: ... Let’s break down the command that we ran * gcc — This is our compiler. We execute it by typing its name, gcc, to the command line. * -c — ...