r/cpp • u/bsdooby • Mar 01 '23
[Q] Windows: non-MSVC Toolchains
I'm unsure what the "best" C++ compilers (ease of installation, updateability usability, supported C++ standard, code perf.) are on current Windows systems, not counting MSVC. MSys, MinGW, Gygwin, etc. ...
2
u/RennyLeal Mar 02 '23
Check this https://blog.conan.io/2022/10/13/Different-flavors-Clang-compiler-Windows.html
"Conclusions The Cygwin Clang has been overwhelmingly replaced by the Msys2 flavors for this reason we are suggesting starting new efforts using the other flavors.
To decide between the MSVC based Clang flavors (LLVM/Clang and Visual Studio ClangCL) and the Msys2 based ones, the decision should be made depending on the other project constraints. In general the MSVC based Clang provides better compatibility with other Windows binary libraries and the system in general, while using the Msys2 subsystem flavor can work better if there are some other dependencies that heavily rely on GNU tools and wouldn’t work well with the MSVC compiler.
Between Msys2 Clang and Msys2 MinGW Clang, the decision should be made similarly. If there are other dependencies of the project that rely on libstdc++ runtime that have to play together, Msys2 MinGW Clang is probably the way to go, but otherwise, it seems that Msys2 Clang with libc++ could be the way to go.
In MSVC-based Clang, between LLVM/Clang and Visual Studio ClangCL, the final decision is probably the IDE. If a lot of development happens on Windows and developers want to use Visual Studio IDE, then the Visual Studio ClangCL will be better. If on the contrary most development happens in Linux, and Windows devs are happy with VS Code editor and using Ninja (which many developers love because of it being very fast), then LLVM/Clang could be a better choice."
1
1
u/Ameisen vemips, avr, rendering, systems Mar 08 '23
I need to spend more time getting the JVM build scripts working with msys2.
10
u/TimJoijers Mar 01 '23
clang is good. Avoid mingw because linking can be very, very slow with it. My hobby project builds in 2 minutes on other compilers, mingw spends 30 minutes linking.
3
u/KingAggressive1498 Mar 01 '23
msvc will give you the easiest time if you have to build any dependencies from source, because Cmake and boost.build and Windows batch files want to use Visual C++ by default on Windows. Unix makefiles tend to be iffy as far as working with mingw32-make as well, and for autotools based build scripts you need a unix-like shell (ie msys2)
Also while I have many minor greivances with Visual Studio that lead me to prefer another IDE, in terms of feature set its really the best free (via community edition) IDE on Windows.
If you decide to use mingw anyway, I strongly recommend you just go get msys2 and get your mingw installation through their package manager (which also includes binaries and development files for most major open source libraries, making your life easier). Most other mingw distributions are at least a few years out of date in terms of compiler version.
4
u/vickoza Mar 01 '23
I would agree with LLVM\Clang is the best C++ toolchain on Windows besides MSVC only thing is that you might not have full C++20/23 support especially for the standard library.
2
u/InjAnnuity_1 Mar 01 '23
There's also Embarcadero, a full IDE and toolchain, with the ability to use most of the many Delphi (Pascal) libraries. It uses an older version of Clang, modified to support a few extensions needed to produce code that can link with those libraries. I've found it straightforward to use and install.
In one developer's experience, the debugger can get confused. I suspect it's because they've created large namespaces, and #included files with unusual filename extensions.
2
u/catcat202X Mar 02 '23
No one here speaks of the Orange C++ toolchain 😿 https://github.com/LADSoft/OrangeC
3
u/firkinblood Mar 01 '23
I'm using w64devkit mingw. I still have to support Windows 7 and XP targets. I use msys2 for my primary dev setup, but w64devkit for a more controlled release build.
1
1
u/RennyLeal Mar 02 '23
Check this https://blog.conan.io/2022/10/13/Different-flavors-Clang-compiler-Windows.html
"Conclusions The Cygwin Clang has been overwhelmingly replaced by the Msys2 flavors for this reason we are suggesting starting new efforts using the other flavors.
To decide between the MSVC based Clang flavors (LLVM/Clang and Visual Studio ClangCL) and the Msys2 based ones, the decision should be made depending on the other project constraints. In general the MSVC based Clang provides better compatibility with other Windows binary libraries and the system in general, while using the Msys2 subsystem flavor can work better if there are some other dependencies that heavily rely on GNU tools and wouldn’t work well with the MSVC compiler.
Between Msys2 Clang and Msys2 MinGW Clang, the decision should be made similarly. If there are other dependencies of the project that rely on libstdc++ runtime that have to play together, Msys2 MinGW Clang is probably the way to go, but otherwise, it seems that Msys2 Clang with libc++ could be the way to go.
In MSVC-based Clang, between LLVM/Clang and Visual Studio ClangCL, the final decision is probably the IDE. If a lot of development happens on Windows and developers want to use Visual Studio IDE, then the Visual Studio ClangCL will be better. If on the contrary most development happens in Linux, and Windows devs are happy with VS Code editor and using Ninja (which many developers love because of it being very fast), then LLVM/Clang could be a better choice."
22
u/Trider12 Mar 01 '23
Clang. It's even available as an option in Visual Studio.