c++ – Visual studio vs gcc


Myself, I only use the free Visual Studio edition, not the “full” one. Mostly interested in the C++ compiler and the debugger.

My CMake setup supports both Windows and Linux builds — which is a bit tricky at times, but since the initial setup work it’s mostly about adding new sources, which is much more convenient now compared to having two distinct build systems (initially, I used cmake for Linux and a VisualStudio-solution for Windows).

Along the same lines, I want to look into getting vcpkg for the Linux build as well, instead of having a “ReadMe” about which packages to install on the system. It would also solve the problem of Debian always having packages that are somewhere between outdated and very outdated 🙂

I use g++ to compile for Linux, and VisualC++ to compile for Windows. VC++ has the advantage that it is the “native” compiler for Windows; it can directly work with the Microsoft Windows SDK and produces all the debug-info that the VisualStudio debugger needs. Also, the FSF hates Windows — so their so-called ports are pretty rubbish.

In addition, VC++ is completely unrelated to g++ — sometimes, one of them complains about a problem that the other did not notice. While I still can’t guarantee that the portable part of the code is 100% standards-compliant, having 2 compilers accept it is better than just 1 (Linux- and Windows-specific sources are only fed through one compiler, obviously).

It also happens that an error message that’s completely mystifying on one compiler turns into a simple “oh, that’s what it’s complaining about… why didn’t you just say so” on the other.

I might even be adding clang++ as a third option, but I’m not sure how well this can coexist with g++ on Linux, and it’s also trying to mimick g++ shenanigans so it’s likely less useful for catching portability issues.

In general, even if this weren’t meant to be portable, I generally prefer the native solutions if at all possible. g++ on Windows feels like a bad idea to me.
Of course, this would change if Microsoft killed the free edition, unless Windows-g++ turned out to be unbearable.

Leave a Reply

Your email address will not be published. Required fields are marked *