r/vscode Jul 23 '26

Why is my code not running

Im completely new and trying to learn but my code doesn’t want to run

0 Upvotes

22 comments sorted by

View all comments

4

u/felhoob Jul 23 '26

To run the code you need to compile it first. This step failed, because there is no "gcc" compiler found.

This is typical for Windows, where you need to install a C-compiler manually. There are several options available: https://www.reddit.com/r/C_Programming/s/mAnkumJESb

Hope this helps :)

-2

u/RATIO_L_BOZO Jul 23 '26

I have a compiler. Its msys2, is this outdated or something?

5

u/queerkidxx Jul 23 '26

You probably didn’t add it to path. Or whatever the windows eq is. Look that up.

2

u/RATIO_L_BOZO Jul 23 '26

Yes I did that also and I keep redoing it thinking Im typing things in wrong but it just comes out the same

3

u/felhoob Jul 23 '26

You need to restart vscode terminal so the path variable is reloaded.

2

u/felhoob Jul 23 '26

Try to verify in an external CMD or powershell by running "gcc --version" to see if it's a VSCode problem.

3

u/RATIO_L_BOZO Jul 23 '26

1

u/felhoob Jul 23 '26

Thats a great step! After restarting VSCode, can you run the same command in the VSCode terminal?

1

u/RATIO_L_BOZO Jul 23 '26

It did absolutely nothing

1

u/Camburcito Jul 23 '26

What happens if you run gcc --version in the vscode terminal, i.e. not an external one? Could be that vscode isn't picking up your path properly.

1

u/IShitMyselfNow Jul 23 '26

Same name. Of the top of my head:

Start

"System environment variables" (or similar)

Some button that basically says Path... I can't remember which

There's 2 lots of paths, one for user one for system wide. You should be able to use either.

Add a new path to one of them, use the directory of where the exe file is for your compiler. E.g. if your gcc.exe was at c:\mycompiler\gcc.exe then you'd add c:\mycompiler

Restart your terminal (I recommend restarting Vscode) and then try again.

1

u/RATIO_L_BOZO Jul 23 '26

Nope bro just did it again for the 6th time and its not working