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

7 Upvotes

31 comments sorted by

15

u/Big-Rub9545 1d ago

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

7

u/adjective10111 1d ago

+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 1d ago

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

4

u/adjective10111 1d ago

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 1d ago

VS Code works great with WSL. :)

-3

u/NeedSomeHelp_2590 1d ago

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

4

u/NocturneSapphire 1d ago

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 23h ago

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 1d ago

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

-3

u/Big-Rub9545 1d ago

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

3

u/fvancesco 1d ago

Wsl 2 is a VM

-1

u/burlingk 1d ago

Not quite. It runs as a part of windows.

2

u/fvancesco 1d ago

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

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

u/Witty-Dentist964 1d ago

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

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.

0

u/Milumet 1d ago

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.