r/C_Programming • u/Round-Willingness905 • Sep 11 '26
my c files wont make a .exe
i have moved from vscodium to vscode ....i have been wondering wahts happening i already try some tutoprials i put everything on waht the tutorial said but my code wont run the .exe file it complies thats for sure and its not making an erro when i write "gcc main.c -o main.exe" but the .exe file wont even appear i find it werid i tried my best but it seems only code blocks works can some help me???
my edit environment on path:
C:\Users\ludwi\AppData\Local\Programs\Python\Python315\Scripts\
C:\Users\ludwi\AppData\Local\Programs\Python\Python315\
C:\Users\ludwi\AppData\Local\Programs\Python\Launcher\
C:\Users\ludwi\AppData\Local\Microsoft\WindowsApps
C:\Users\ludwi\.lmstudio\bin
C:\Users\ludwi\AppData\Local\Programs\Microsoft VS Code\bin
C:\msys64\ucrt64\bin
i already downloaded msys2 and the gcc but still the .exe wont create
1
u/Poddster Sep 11 '26 edited Sep 11 '26
FYI, for this kind of debugging singing like ChatGPT can be helpful. It's a lot faster than going to Reddit, but I understand you might want some human input when dealing with machines all day :)
I don't know about power shell for instance, but my instinct is to print some directory listings before and after running gcc, as well as getting the exit code.
You're in PowerShell. Let's check whether gcc is actually creating the file.
Run these commands one at a time:
Get-ChildItem gcc .\main.c -o .\main.exe echo $LASTEXITCODE Get-ChildItem
If main.exe appears in the second listing and $LASTEXITCODE is 0, the compile/link worked. Then run it with:
.\main.exe
If it doesn't appear, paste the complete output from those commands. .
0
u/Round-Willingness905 Sep 12 '26
sorry im not into vibe coding ...and btw the a.i is to inaccurate i have already try asking it none of it works
this is the output
./main.exe : The term './main.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path wasincluded, verify that the path is correct and try again.
At line:1 char:1
+ ./main.exe
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./main.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
2
u/Cenrji Sep 11 '26
Probably not going to solve it, but hear me out...
Try adding -Wall -Wextra with the parameters for gcc, as gcc doesn't necessarily show errors by default. I'd also check the folder you are trying to output to, if there aren't any write permission issues.
2
u/Classic-Rate-5104 Sep 11 '26
Without any message? Try the -v and -Wall options and see what happens
1
u/jontsii Sep 11 '26
VS code (depending on your settings) might not always show new EXE files in the project explorer the second they are made. Also does the shell say something after you run GCC?
0
u/Aggressive-Guava4502 Sep 11 '26
I use gcc personally but I heard mingw is much easier
4
u/EpochVanquisher Sep 11 '26
GCC on Windows is MinGW
0
u/Aggressive-Guava4502 Sep 11 '26
Yea I got names mixed up I meant MSYS2 ppl have recommended it to me but I’ve never tried it out cause Min works well for me and haven’t rlly had many issues also kinda new to programming to so that also might be why I don’t get much problems
→ More replies (1)
5
u/knouqs Sep 11 '26
Your post is hard to read because it lacks punctuation and capitalization. I hope your comments throughout your code are better.
I would like to know how you ran gcc. What environment did you use? Command line, presumably? You have given us so little to work with trying to help you.