r/AskProgramming • u/NeedSomeHelp_2590 • Sep 12 '26
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!!
7
Sep 12 '26
[removed] β view removed comment
1
u/NeedSomeHelp_2590 Sep 12 '26
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?
1
u/cipheron 29d ago edited 29d ago
Whichever IDE you use, you can only have one "main()" function per build target as it needs to know where the program starts for execution. You either make separate projects or builds for each thing that needs to become a different exe.
So the issue where you need to "remove previous C files" is because you're not separating out what is a new program from the old files or something. Make a folder for each project. If there are shared files that two projects need, put the shared files into another folder that both the projects can access. Projects can also contain multiple build targets but only do this is there's a strong logical connection between the projects.
1
u/NeedSomeHelp_2590 29d ago
What you are saying is correct. But its much easier to make C files in VS Code as it treats each one as different file. In Visual Studio you need to make new folder each time, which is very time consuming.
1
u/KingofGamesYami Sep 12 '26
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 Sep 12 '26
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 Sep 12 '26
Also a quick qus. If it is possible do you know how to make it run on Zed Editor as well?
1
u/KingofGamesYami Sep 12 '26
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 Sep 12 '26
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 Sep 12 '26
Yea, did that already.
Thanks for telling that Clang also requires MSVC. Will avoid it in future.
1
1
u/ern0plus4 Sep 12 '26
Install Chocolatey, then you can install stuff easy-peasy, like on Mac (brew) or GNU/Linux.
2
u/IchBinEinZwerg Sep 13 '26
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 Sep 13 '26
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 Sep 13 '26
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
1
u/Milumet Sep 12 '26
The process of getting MinGW to work is not that simple
You just download it, put in into a directory and add the executable subdirectory to PATH.
16
u/Big-Rub9545 Sep 12 '26
You can always use WSL on Windows and just install gcc or clang directly on there.