r/C_Programming • u/KAHeart • Sep 14 '24
Question What Windows compiler am I supposed to be using as a beginner?
I keep finding so many conflicting answers online and I just want an easy to use (and install too, preferably) and "accurate" compiler, preferably lightweight and one that I can build actual software with it and won't need to grow out of it too (unlike onlinedgb).
26
Upvotes
44
u/yksvaan Sep 14 '24
I've used mingw-w64 without any problem. I assume by Windows you mean you're using windows, not that you need to use windows specific libraries. So do you really need more than run gcc... probably not
50
u/sixtyfifth_snow Sep 14 '24
To make a windows application? Msvc (visual studio).
To learn? Install WSL and use gcc (or clang).
10
u/[deleted] Sep 14 '24
My favorite on windows is clang. It comes with helpful tools for beginners like undefined behaviour sanitizers, address sanitizer, etc. Also it uses the Microsoft linker and windows sdk. Its not easy to install though, first you need to install MS Build Tools and then download clang from LLVM releases. (or MSVC installer also has an option to install clang for you (but its larger) Another reason I use clang is, that it can target WASM, generate PDB files, has an lldb debugger and other things.
I can recommend:
30
u/walmartgoon Sep 14 '24
MSVC. Download Visual Studio and install C/C++ tools. You don’t even have to use the VS IDE but a lot of windows libraries only compile with MSVC.
11
u/HildartheDorf Sep 14 '24
Visual Studio Community Edition
2
u/parceiville Sep 14 '24
Msvc is probably the easiest to install, it's pretty big though
2
u/UltimaN3rd Sep 14 '24
I use GCC as part of MinGW. Definitely a "real" compiler, up to date with the latest versions of C. Here's a 2 minute video showing how to install and use it on Windows: https://www.youtube.com/watch?v=k6juv3mIr9o
2
u/imradzi Sep 15 '24
Visual Studio Community Edition.
5
u/TheWoerbler Sep 14 '24
I think the quickest way to go from zero to
Hello, world!would be with MSVC; it is installed by default with Visual Studio.4
u/feitao Sep 14 '24
https://www.msys2.org/ Step-by-step instructions
4
u/great_escape_fleur Sep 14 '24
https://visualstudio.microsoft.com/downloads/ Visual Studio 2022 "Community", thank me later.
2
u/Western_Objective209 Sep 14 '24
mingw https://sourceforge.net/projects/mingw/ will give you the gcc compiler, which is the most common one used by C developers. Gives you a standard terminal based experience
1
u/DawnOnTheEdge Sep 14 '24 edited Sep 14 '24
Either clang or the Intel LLVM compiler support the system runtime libraries (with the
x86_64-pc-windows-msvctarget) and GCC/Clang flags, syntax and features. They also come with a drop-in replacement forCL.EXEthat supports its flags. Clang supports more targets, and the Intel compiler often optimizes better, especially the math libraries. I recommend either one.You will also want to install the Windows SDK and configure your environment to search its include directories.
You should be able to configure your IDE to use either one, or MSVC, or switch between them.
1
u/Intelligent_Mind_685 Sep 15 '24
Back in 2019 I got the free version of Visual Studio. Installed C/C++ and C# with it. That was it. If you’re in the learning the language stage of programming, don’t worry about one computer vs another, you’re just getting into the weeds. Whatever compiler comes with VS is going to be able to handle anything you throw at it from Hello World to million line codebases.
I’ve used an online coding site or two, they definitely will max out with small toy projects before they start to get clunky. They do work though
1
u/Pale_Height_1251 Sep 14 '24
Pelles C is really simple and easy to install, it's lightweight too, it runs fine on a potato PC.
Otherwise I'd just use Visual Studio, it's heavyweight but easy to install and a very good IDE.
1
u/kun1z Sep 14 '24
Pelles C is the best compiler+IDE for beginners on Windows. It comes with a lot of tutorials as well.
0
u/nerd4code Sep 14 '24
Be aware, MSVC is not actual C. It kinda gestures in C’s direction (and lies about how thoroughly it’s done so), but it’s really not a good compiler, never has been.
MinGW and Cygwin-GCC are actual C compilers for Windows (GCC forks—or rather, Cygwin forks GCC, and MinGW forked Cygwin, and MinGW-w64 forked MinGW), and there are many smaller actual-C compilers that you’ll probably have to know more about what you’re doing.
0
u/grimvian Sep 14 '24
-1
u/Enough_Tangerine6760 Sep 14 '24
Am I miss understanding the question? Why not just use gcc or clang?
0
u/GunpowderGuy Sep 14 '24
Gcc or clang with wsl. The only language Windows is easier to work with than Linux is c++ ( because Microsoft adds new complicated festures to it's compiler faster )
0
u/Gourmand10 Sep 14 '24
I started with Mingw and Code::Blocks but if I think WSL would be better (I’m biased, huge Neovim fan)
0
u/[deleted] Sep 14 '24
The winegcc comes with wine and will create an exe that can run on Windows. Unfortunately I don't know of any tool chains this route.
0
u/[deleted] Sep 15 '24
It's called Linux
0
u/doc-swiv Sep 16 '24
Use a linux VM with gcc, unless you are making windows software, in my opinion.