1

I installed the MinGW-w64 C/C++ package on C:\.

What are the system environment variables I should add into the Windows OS so that I can code in C/C++ on VS Code e.g. C:\MinGW-w64...\bin, etc?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • No need to set any environment variables and it's often better if you don't. Invest a bit more time in researching build automation tools (cmake is deservedly popular) and use it. You specify the locations of the relevant files to the build tools and away you go. This becomes really important when you're working with many compilers and versions of the same compiler all at once. Chaos ensues when you have too many build tools in the system path. – user4581301 Jan 15 '22 at 03:36
  • Just noticed the note about VS Code. I believe it favours cmake, but I'm far from an expert in it. – user4581301 Jan 15 '22 at 03:37
  • Side note: There are a lot of MinGW distributions out there and some of them are... kinda bad. Go to the bin folder and run `gcc -v` if the version is less than 8, consider using a different one because the one you have has gotten a bit stale. [Here are instructions](https://stackoverflow.com/a/30071634/4581301) for installing a good, up-to-date one with with a package manager you can use it to stay up to date and get an impressive ecosystem of pre-built libraries and tools. – user4581301 Jan 15 '22 at 03:40

1 Answers1

0

You shoul add the path of the GCC compiler mostly it should be like C:\MinGW\Bin (here C:\ can also be something if you put that at some other place or a different drive, I normally install it directly in C drive and it works well)

Search for Path in Windows Search, you'll find an option of "Edit Environment and Path Variables" Open it Go to system variables (so it can be available to all users) Click on the path, there will be some blank lines, paste your copied path from Windows Explorer, or click the browser option to browse it. The main thing to add in path in MinGW\Bin which contains all compile binaries)

I hope you get what I went to say.