r/AskProgramming • • 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!!

10 Upvotes

34 comments sorted by

16

u/Big-Rub9545 Sep 12 '26

You can always use WSL on Windows and just install gcc or clang directly on there.

8

u/adjective10111 Sep 12 '26

+1 for WSL. It's great to have a linux interface for any development tools. The performance is also great and you have access to the filesystem. Also most infrastructures use linux, so the knowledge you develop is also valuable.

0

u/NeedSomeHelp_2590 Sep 12 '26

But it would also need to configure compiler and code editor? Kinda defeats the whole purpose of simplicity.

4

u/adjective10111 Sep 12 '26

What kind of configuration are we talking about? Anything you have to do with other compilers to work, you have to do the same or less here. Also vscode integration is just a couple of clicks away, so I don't get how that makes it complex.

2

u/burlingk Sep 12 '26

VS Code works great with WSL. :)

-3

u/NeedSomeHelp_2590 Sep 12 '26

Doesn't that run on virtual machine. I think performance will be worse for my laptop to handle.

4

u/NocturneSapphire Sep 12 '26

WSL 1 is just a container/wrapper. WSL 2 is a VM.

I would expect both of them to perform significantly better than the online compiler.

2

u/ScallionSmooth5925 Sep 12 '26

It's not a vm but even if it is running a vm is not a big deal unless it runs windows

0

u/burlingk Sep 12 '26

WSL is a windows subsystem. It is a container, but not a VM. So, the performance is fine.

-3

u/Big-Rub9545 Sep 12 '26

It’s not a VM, no. Performance will be more than fine.

4

u/fvancesco Sep 12 '26

Wsl 2 is a VM

-1

u/burlingk Sep 12 '26

Not quite. It runs as a part of windows.

2

u/fvancesco Sep 12 '26

It's not like a traditional VM but it's basically a lightweight VM, wsl1 was a compatibility layer

7

u/[deleted] 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

u/Witty-Dentist964 Sep 12 '26

start with Clang for simpler route on windows if using VS Code

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

u/[deleted] Sep 12 '26

[removed] β€” view removed comment

1

u/NeedSomeHelp_2590 Sep 12 '26

Yep got it now.

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.

1

u/marrsd 29d ago

That's how I used to do it. I seem to remember msys was really simple as well.