r/C_Programming • u/IndoRexian2 • May 21 '26
Question gcc unable to create the executable
Hi y'all, I've been trying to learn C and I installed mingw using msys2.
I'm trying to compile the following code:
// hello.c
#include <stdio.h>
int main(void)
{
printf("Hello, Windows!\n");
return 0;
}When running gcc hello.c -o hello.exe, I don't get any executable. I've tried reinstalling mingw, and I've also checked that I'm running the command on the same directory where the file. I also added the particular folder to Windows Defender Exclusion list but still can't get anything done. What am I doing wrong?
Edit: Got it to work by changing my terminal from Powershell to Git Bash.
Edit 2: Even msys2 terminal works. I'm using that only from now-onwards.
View all comments
Show parent comment
3
u/IndoRexian2 May 21 '26
When I tried to do
ls -aI found out Windows terminal doesn't even recognize that parameter so after searching online, I found out that I could use the git bash to run those commands and voila! runninggcc hello.c -o hello.exestraight on worked. Idk why the powershell wont work but i guess this will do too!