Which C/C++ compiler is easiest to set up on Windows?
Asked by
MellowOrbit42
I've just started learning C and have been using an online compiler, but I'd like to move to VS Code and compile programs locally. I've looked at MinGW and Clang, but getting MinGW configured seems more complicated than expected. Would installing LLVM from its official website be enough to get Clang working on Windows? How do Clang and MinGW compare, and which option would be the better choice for a beginner?
Answers
Clang and MinGW are both valid choices, but neither is automatically better for learning basic C. The important part is having a compiler, debugger, and build setup that you understand. On Windows, MSVC is well integrated, while Clang or GCC through WSL gives you a more Unix-like workflow. Also, when working with multiple C files, make sure you compile them as one project or build command rather than trying to compile several files that each contain their own main function.
Reply to this answer
You can also use WSL and install GCC or Clang in a Linux environment. It generally performs well and gives you experience with tools similar to those used on many real development systems. It does add another environment to learn, though, so MSVC may be less confusing if you mainly want a straightforward Windows setup.
Reply to this answer
Since youโre using Windows, MSVC is probably the simplest native option. Installing Visual Studio gives you the compiler toolchain, and you can configure VS Code to use that compiler through its C/C++ extensions. The same setup works for both C and C++, even though many guides focus on C++.
MellowOrbit42: I already had Visual Studio installed, so I didnโt realize I could use its compiler from VS Code too. That makes things much easier.
Reply to this answer
Add your answer
Answers are reviewed before publication.
SilverMaple8: I was worried WSL would run like a slow virtual machine, but it usually has much better performance than a traditional virtual machine. Still, a native compiler may be simpler for a beginner.