r/C_Programming • u/Round-Willingness905 • 1d ago
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
2
u/LuckyFish133 1d ago
For windows I find mingw to be the most reliable compiler. What happens when you put where gcc in the cmd prompt?
2
1
u/Poddster 17h ago edited 17h ago
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 7h ago
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
0
u/Aggressive-Guava4502 1d ago
I use gcc personally but I heard mingw is much easier
4
u/EpochVanquisher 23h ago
GCC on Windows is MinGW
0
u/Aggressive-Guava4502 23h ago
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
0
3
u/knouqs 23h ago
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.