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)
September 27, 2006 - 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.
🌐
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 ...
🌐
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 ...
🌐
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).
🌐
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.
🌐
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.
Find elsewhere
🌐
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.
🌐
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!
🌐
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.
🌐
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
🌐
Guru99
guru99.com › home › c programming › how to download and install gcc compiler in c for windows pc
How to Download and Install GCC Compiler in C for Windows PC
August 8, 2024 - 2. After the file is being downloaded on the machine, double click and follow the wizard and install the file. Always keep the default settings as suggested by the installation wizard. 3. After the installation process, open a terminal and run gcc -v command to check if everything is successfully installed. ‘C‘ program can be written and executed on any machine that has a suitable environment to run the program. Its recommended using an IDE or C compiler for Windows to run C programs.
🌐
Reddit
reddit.com › r/c_programming › easiest way to set up c compiler on windows 10 (if you use visual studio code)?
r/C_Programming on Reddit: Easiest way to set up C compiler on Windows 10 (if you use Visual Studio Code)?
March 8, 2023 -

I've been learning C and playing around with it for a couple of months already.

I'm following CS50 course and first half of the course is almost entirely in C.

That being said, I only used their online codespaces so far, - and for my own personal practice, I used online complilers such as https://www.programiz.com/c-programming/online-compiler/

and https://www.onlinegdb.com/online_c_compiler .

This allowed me to focus on coding and not worry about compiling. I've made some stuff already, entirely using these tools.

However, now arrives the time that I need my own compiler on local machine.

The main reason is that I want to start practicing working with files on my own hard disk, and also using libraries outside of what these tools offer, such as conio.h.

I already tried to google how to set-up a compiler in Windows, but I've bumped into many hoops and obstacles and it's not (at least for me) as straightforward as it might seem.

So I'm asking you for help to set up my own coding environment for C in Windows, where I could compile the files (ideally with make too, and not just clang), where I could include external libraries, where I could work with files on my own HDD, etc... And ideally, where I could even turn these files into classical .exe files.

Thanks!

EDIT: Resolved:

Installing Visual Studio 2022 Community with included tools for C++, and then running Developer Command Prompt allowed me to compile C files by using command: cl filename.c which returns exe file, filename.exe . This exe file can be started by simply executing filename in command prompt or even from Windows by simply double clicking on its icon, like any other file. Thanks for all the responses, especially to RidderHaddock and _mutaz_ who gave me best directions.

🌐
GeeksforGeeks
geeksforgeeks.org › c language › compiling-a-c-program-behind-the-scenes
Compiling a C Program: Behind the Scenes - GeeksforGeeks
We first create a C program using an editor and save the file as filename.c In linux, we can use vi to create a file from the terminal using the command: ... In windows, we can use the Notepad to do the same.
Published   July 23, 2025
🌐
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
Answer: Are you trying to target Linux/BSD? In that case, beware that the stock compiler in MinGW or Cygwin will not be of use. They target their own environment, and the generated binary will not work on that target. In such a case, you will have to download the sources for the entire toolchain...
🌐
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