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
🌐
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 - This wikiHow guide will teach you the easiest ways to compile a C program from source code using GCC. To make sure GCC is installed, run the command gcc --version. Type gcc source_file.c -o program_name and press Enter to compile your source code.
Discussions

gcc - How do I compile a C/C++ program through windows command prompt? - Stack Overflow
However I need to know how to compile a program via windows command prompt as I need to access the assembly code created. My compilers are mingw32-gcc.exe, mingw32-g++.exe ... Then make an environment variable named PATH and paste the complete url like program file (x86)/codeblocks/mingw/bin. More on stackoverflow.com
🌐 stackoverflow.com
How to compile a C program with gcc? - Stack Overflow
I wrote a simple program named b.c to call dir in Windows 10 cmd via C. ... CopyJ:\fundamental of C programming>b 'b' is not recognized as an internal or external command, operable program or batch file. ... I don't think it is path matter. ... Do dir in your current directory and find if there's any new executable created. By default, gcc ... More on stackoverflow.com
🌐 stackoverflow.com
What is the correct way to compile c code
gcc main.c path/to/cfiles/*.c -I path/to/headers -o main Note that that is a capital i before path/to/headers not lowercase L If everything is in the same directory just do: gcc ./*.c -o main More on reddit.com
🌐 r/cprogramming
17
6
June 2, 2023
Compiling a C++ program with GCC - Stack Overflow
Just one line code on the Windows command line (CMD). First, confirm that you have installed gcc (for C) or g++ (for C++) compiler. ... If it is installed then proceed. Now, compile your .c or .cpp using the command line. ... Here exe_filename (myfile in example) is the name of your .exe file ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
NTU
www3.ntu.edu.sg › home › ehchua › programming › cpp › gcc_make.html
GCC and Make - A Tutorial on how to compile, link and build C/C++ applications
> g++ -c file1.cpp > g++ -c file2.cpp > g++ -o myprog.exe file1.o file2.o · To compile and link C/C++ program into a shared library (".dll" in Windows, ".so" in Unixes), use -shared option. Read "Java Native Interface" for example. GCC compiles a C/C++ program into executable in 4 steps as ...
🌐
FEA for All
feaforall.com › install-c-language-gcc-compiler-windows
How to install the C language GCC compiler on Windows - FEA for All
February 10, 2019 - ... Write your C language code in a text file “helloworld.c”, save it. Then use GCC to compile it: Open the terminal, enter the command “gcc helloworld,c -o helloworld”. That’s the way it works!
🌐
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 - Save this file as hello.c. ... Compile: gcc filename.c -o outputname Run: ./outputname.
🌐
Scaler
scaler.com › home › topics › download and install c/gcc compiler for windows
Download and Install C/GCC Compiler for Windows - Scaler Topics
March 20, 2024 - Here we write a program to print hello world to demonstrate this step and save the file as Hello.c. Step 3: Open Command Prompt. Now, click on the address bar in the C program's directory, type cmd, and press Enter.
Find elsewhere
🌐
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 - 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 all of the four steps it contains. Of course gcc has options that allow us to stop the compiling process ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › c-compiler-windows-gcc
Install C/GCC Compiler for Windows | DigitalOcean
August 3, 2022 - Press OK on all opened popup windows. Open cmd and write “gcc” in it, press enter/return key. If you see “gcc: fatal error: no input files compilation terminated.”, it means that GCC is successfully installed and you can exit the cmd.
🌐
LinkedIn
linkedin.com › pulse › installing-gcc-compiler-windows-run-c-program-gitbash-david-michael
Installing GCC Compiler in Windows To Run C Program on Gitbash and Setting the PATH Variable
February 5, 2023 - First, you have to install the MinGW32-base package. This package is used to compile the C program, including linker and other binary tools. Right-click on the MinGW32-base option and select Mark for Installation. MinGW32-gcc-g++ Package.
🌐
Visual Studio Code
code.visualstudio.com › docs › cpp › config-mingw
Using GCC with MinGW
November 3, 2021 - If you want more control over the C/C++ extension, you can create a c_cpp_properties.json file, which will allow you to change settings such as the path to the compiler, include paths, C++ standard (default is C++17), and more. You can view the C/C++ configuration UI by running the command C/C++: Edit Configurations (UI) from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)). This opens the C/C++ Configurations page. When you make changes here, VS Code writes them to a file called c_cpp_properties.json in the .vscode folder. Here, we've changed the Configuration name to GCC, set the Compiler path dropdown to the g++ compiler, and the IntelliSense mode to match the compiler (gcc-x64).
🌐
Quora
quora.com › How-do-I-compile-a-C-program-from-GCC-in-Windows-using-a-custom-so-library
How to compile a C program from GCC in Windows using a custom .so library - Quora
If it sees a list of .o files, it will call the linker. ‘g++’ is functionally identical to ‘gcc -x c++’. ... is a compiler developer, GCC contributor and all around enthusiast for compiler and programming language technologies ·
🌐
freeCodeCamp
freecodecamp.org › news › how-to-install-c-and-cpp-compiler-on-windows
How to Install C and C++ Compilers on Windows
February 22, 2022 - Then, you need to open that terminal. As I am using a 64 bit operating system, I have opened the terminal for 64 bit. Apply the command pacman -S mingw-w64-x86_64-gcc to install the compilers.
🌐
Reddit
reddit.com › r/cprogramming › what is the correct way to compile c code
r/cprogramming on Reddit: What is the correct way to compile c code
June 2, 2023 -

I've got a program that is split into header files and c files along with the main. I was told to do gcc main.c <library.c>... for every other code but i don't remember having to do that when I've done stuff with header files in the past. How are you supposed to do this. Also are you supposed to include the headerfile in the .c version that the header is declaring the functions from? Sorry for my lack of technical terms. I'm exhausted today

🌐
Host IT Smart
hostitsmart.com › manage › knowledgebase › 435 › install-gcc-compiler-on-windows.html
How to Install GCC Compiler on Windows?
May 21, 2025 - This simple example shows how GCC compiles a human-written C program into an executable file that the computer can run. Also Read: What is Telnet Command in Windows & How to Use it?
🌐
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 - Running the Program To run our c program go to the directory where your executable file is then, type ./your_executable_filename if you’re on Mac or Linux, or your_executable_filename if you’re on Windows. In our case it will be: ... That’s it. You can now use gcc to build your C programs.
🌐
CodeWithHarry
codewithharry.com › blogpost › how-to-install-gnu-gcc-compiler-on-windows
How to install gnu gcc compiler for C Language on Windows | Blog | CodeWithHarry
MinGW: This is a development environment to run C/C++ programs for Windows. gcc: This is the compiler that we will be using to compile C programs.