How do I set up GCC to learn C/C++ on Windows?

0
13
Asked By CuriousCoder92 On

I'm a beginner programmer looking to dive into learning the C language, but I'm having trouble getting my environment set up. When I try to check if GCC is installed by running 'gcc --version' in Visual Studio Code, I get an error that says: 'The term 'gcc' is not recognized.' I've already installed MSYS2 but I still encounter the same issue. What steps do I need to follow to resolve this? Any guidance would be greatly appreciated!

5 Answers

Answered By PragmaticPaul On

Dealing with the PATH issue is super common on Windows. Just follow the steps mentioned in a tutorial I found, it guides you through setting up MinGW and getting gcc running: https://phoenixnap.com/kb/install-gcc-windows. Once you get gcc working, transitioning to C++ should be fairly easy.

Answered By TechieTina On

If you're looking for a way to learn C while avoiding setup headaches, I highly recommend CS50's Introduction to Programming. The first few weeks focus on C and it uses its own IDE, so you won't have to deal with environment setup initially. Once you're comfortable, pair it with 'The C Programming Language' book by Kernighan and Ritchie for a deeper understanding.

Answered By ConfusedCoder On

I struggled too when I tried to set up VSCode for C++. It was a hassle, so I created a tutorial to help others. You can find the official documentation here: https://code.visualstudio.com/docs/languages/cpp. I also made a video that walks through the setup process, which might help you out: https://youtu.be/4ridGE4jWi0.

Answered By C++Fanatic On

Honestly, it's ridiculous that PCs don't come with a C compiler out of the box! If you're looking for a straightforward solution, I found that you can quickly install MinGW using Chocolatey. Just run 'cmd' as an administrator and type: choco install mingw. Then refresh your environment and check with 'gcc --version'. It should work without too much fuss.

Answered By HelpfulHarry On

It sounds like GCC isn't properly installed or its path isn't added to your system variables. Here's a step-by-step guide: 1. Download and install MinGW-w64 from its official website. 2. During installation, choose x86_64 architecture, posix threads, and seh exception handling. 3. Note the installation folder (usually C:mingw64bin). 4. Press Windows + R, type 'sysdm.cpl', and hit Enter. 5. Go to the Advanced tab and click on Environment Variables. 6. In the System Variables section, find 'Path', select it, and click Edit. 7. Click New and add C:mingw64bin to the list. 8. Save the changes and restart your computer or just the Command Prompt and VS Code. 9. Finally, check again with 'gcc --version' and you should see the version if it's set up correctly!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.