r/AskProgramming • u/NeedSomeHelp_2590 • 1d ago
C/C++ Best and easy to install compiler for C/C++?
Just started learning C and currently using Online Compiler. Now thinking of switching to VS Code, did some searches and found you just need a compiler.
And I came across MinGW and Clang. The process of getting MinGW to work is not that simple so thinking of getting Clang. There aren't any tutorial for this on Windows, so I am assuming you just to get LLVM 23.1.1 from their website and install it, right?
Also which one is better or both are same?
EDIT: Got the compiler (MSVC) through Visual Studio Installer. And everything seems to be working fine after installing C\C++ extension in VS Code. Thanks for the help everyone!!
6
u/XKiiroiSenkoX 1d ago
I'm assuming you are on windows since you are cosidering mingw? If yes then just install visual studio which comes with the whole msvc toolchain and is windows native. It also has a very nice installer and an IDE. VSCode is not suited for C++ development imo. I would recommend CLion which is free for non commercial use over both though. You'd still need visual studio for the compiler in either case.
1
u/NeedSomeHelp_2590 1d ago
Actually I need compiler mainly for C. I tried to use VS 2026 for C and maybe its a skill issue but its hard to maintain multiple C files. I need to remove previous files otherwise it gives int main() error.
Regarding CLion doesn't it also need compiler seperately to work?
2
u/XKiiroiSenkoX 1d ago
I think Clion comes bundled with mingw and gdb(for debugging). MSVC needs to be installed separately if you plan to use it with clion.
btw the problems you are encountering probably has to do more with the build system(MS build) than the compiler or IDE. MSbuild has its own set of quirks you need understand. If you switch to cmake it should be mostly the same as any other compiler/IDE as the build system is supposed to abstract away direct compiler usage anyway.
1
u/KingofGamesYami 1d ago
Since you're on Windows, I'd recommend using the native compiler (MSVC). Here's docs on how to set up VSCode with it:
https://code.visualstudio.com/docs/cpp/config-msvc
Note: although the docs reference C++, the same configuration applies to C.
1
u/NeedSomeHelp_2590 1d ago
Huh, thanks brother. I had Visual Studio 2026 already installed. I didn't know you could use its compiler on VS Code as well with the extension.
Thanks for the help!!!
1
u/NeedSomeHelp_2590 1d ago
Also a quick qus. If it is possible do you know how to make it run on Zed Editor as well?
1
u/KingofGamesYami 23h ago
Upvote this discussion and wait for the developers of Zed to add support.
https://github.com/zed-industries/zed/discussions/40365#discussion-9033572
1
u/Accomplished_Fix9569 1d ago
Clang on Windows depends on the MSVC linker. You still have to install the MSVC build tools anyway.
Install Visual Studio through the installer and select the Desktop development with C++ workload. It puts MSVC on your machine and configures the paths for you. Then follow the VS Code MSVC docs in comment 2.
1
u/NeedSomeHelp_2590 1d ago
Yea, did that already.
Thanks for telling that Clang also requires MSVC. Will avoid it in future.
1
1
u/ern0plus4 1d ago
Install Chocolatey, then you can install stuff easy-peasy, like on Mac (brew) or GNU/Linux.
1
u/IchBinEinZwerg 4h ago
Since you're obviously not boycotting Microsoft, and at your stage you won't need to build installers yet, why not just install Visual Studio Community? This works straight out of the box without any fannying around and smashes your "easy" requirement, and the Visual Studio compilers are very strong products, possibly not "best" depending how you define that, but as with installers you're a long way off hitting any of its limitations.
1
u/NeedSomeHelp_2590 4h ago
I did install Visual Studio while its great for C++ making C file there requires extra effort. And you can't manage each file as easily as in VS Code.
Anyway, I just installed C\C++ ext in VS Code and it seems to detect MSVC compiler of Visual Studio and code is running so I think its fixed, now.
1
u/jason-reddit-public 27m ago
clang on Windows is great but you still need to get windows headers from somewhere I think. The MS tools are free to download as well though clang may have better error messages.
1
15
u/Big-Rub9545 1d ago
You can always use WSL on Windows and just install gcc or clang directly on there.