Advertisement

Compilers

Started by July 18, 2016 03:50 PM
26 comments, last by ccuccherini 8 years, 4 months ago

I'm pretty much just starting out with the whole game development thing. I have already started to learn C++ at Old Dominion University as a part of my degree program and not only love it so far but find it pretty easy up to this point. The problem I am running into now is that the compiler I use at school (DevC++) is not compatible with the operating system on my computer or on my Surface. Both have Windows 10 and I while I can link in to the virtual desktop that the school has from home I would much rather not have to rely on this for my programming needs outside of the classroom.

I was wondering if anyone knew of any good compilers that I could get and install on my computer that are also compatible with Windows 10? At this point I would like to keep costs to a minimum, but am open to any and all suggestions any of you have. If it helps, my laptop has an i7 intel processor and if I'm remembering correctly my Surface has an Atom x7 processor.

You can download and install Visual Studio Community edition for free. Remember to select the C++ environment since it is not enable by default in VS 2015.

You can get it from here: https://www.visualstudio.com/products/visual-studio-community-vs.aspx

There are also the express edition which are lighter to download and install and are still free (and doesn't have any commercial limitation) however they do not support the installation of 3rd party plug-ins, and the C++ support comes in two distinct edition (one for traditional Desktop and one for Microsoft Store UWP applications).

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/
Advertisement

You can download and install Visual Studio Community edition for free. Remember to select the C++ environment since it is not enable by default in VS 2015.

You can get it from here: https://www.visualstudio.com/products/visual-studio-community-vs.aspx

There are also the express edition which are lighter to download and install and are still free (and doesn't have any commercial limitation) however they do not support the installation of 3rd party plug-ins, and the C++ support comes in two distinct edition (one for traditional Desktop and one for Microsoft Store UWP applications).

Thank you Alessio! I'll check it out over the next couple of days and see how they work for me. I greatly appreciate it!

MinGW is also available for Windows 10, it is a port of the GCC (default compiler for most Linux distros). There is no IDE and everything is done through the command line, if you're into that sort of thing.
Advantages:
- no IDE means zero start-up time
- better C++ language standard compliance
- no pesky project settings to get lost in
- produces well-optimized code
- (optional) often possible to compile code written for a different platform, but only if you manage to install msys/binutils and such correctly
Disadvantages:
- your IDE is pretty much just notepad
- no microsoft-specific compiler extensions
- no project settings means you have to either manually enter the locations of all libraries and include directories, or get good at MAKE.
- makefiles targetting MinGW are rather more rare in the wild than VS project files, when dealing with projects downloaded from the internet.
I would strongly advise against using a MinGW-derivate as a beginner and I am saying that as someone who uses MinGW for all his hobby work and enjoys that.

C++ has enough problems and pitfalls for a beginner. You should not add even more problems on top of that by using the non-standard compiler for your OS.

And if you still disregard my advise above, at least get a proper IDE. Personally I have come to like QtCreator a lot (and I do not use an iota of Qt).

Advantages:
- no IDE means zero start-up time
- better C++ language standard compliance
- no pesky project settings to get lost in
- produces well-optimized code
- (optional) often possible to compile code written for a different platform, but only if you manage to install msys/binutils and such correctly

Non of there are advantages of non-MSVS nor they are disadvantages of MSVS, as they are easily achievable with the Microsoft compiler.

Advertisement

MinGW is also available for Windows 10, it is a port of the GCC (default compiler for most Linux distros). There is no IDE and everything is done through the command line, if you're into that sort of thing.
Advantages:
- no IDE means zero start-up time
- better C++ language standard compliance
- no pesky project settings to get lost in
- produces well-optimized code
- (optional) often possible to compile code written for a different platform, but only if you manage to install msys/binutils and such correctly
Disadvantages:
- your IDE is pretty much just notepad
- no microsoft-specific compiler extensions
- no project settings means you have to either manually enter the locations of all libraries and include directories, or get good at MAKE.
- makefiles targetting MinGW are rather more rare in the wild than VS project files, when dealing with projects downloaded from the internet.

Thank you for the suggestion. I think I may save this one for after I get more experience and more comfortable with programming in general.


Advantages:
- better C++ language standard compliance

Non of there are advantages of non-MSVS nor they are disadvantages of MSVS, as they are easily achievable with the Microsoft compiler.

Microsoft's compiler still lags a bit behind on conformance issues, not much now, but some. There are some language features that can't be fully supported (or at all) until their compiler rejuvenation project is complete. They've written about it on their blog, but the basic problem is that for historical reasons the compiler took things from source to final representation as quickly as possible, so unlike most other compilers there's no intermediate form representation of the entire translation unit, and this makes a few of the new language features very difficult to achieve. Good progress is being made on the rejuvenation though, they announced their SSA optimizer recently, which is a first step in resolving the legacy problem. There is an interim sort of work around, though, that I'll speak to in a bit.

OP:

First, we need to settle on some terms -- A Compiler is the program that transforms your source code to machine code in an object file; notable examples are GCC, Clang, and Cl (Microsoft's compiler). An IDE is the tool many people use to write their source code, manage their projects, debug, and do other things; notable examples (for C++) are DevC++, XCode, and Visual Studio. You don't need an IDE to write code -- you can use any text editor you like, or other IDE-lite offerings -- as long as you're comfortable doing your compiling and linking from the command-line, and with debugging with stand-along tools like WinDBG or GDB. For running your builds, things like MAKE and MSBuild exist -- those allow you to build your program for various targets easily, from the command-line.

For an IDE, Visual Studio Community is probably your best bet right now -- As long as you select the C++ tools during install, everything should be set up. Other IDE options, IDE-lites, and text-editor-based workflows usually require a bit of extra setup.

For the compiler, there are a few things to address -- I'd wager that DevC++ in your instance is pointing to a GCC compiler, or possibly to Clang. Either of these have different command-line options and language support than Microsoft's compiler. If its the case that you'll need to use a compatible compiler for you course-work, you'll need to set them up. Possibly, one option is Microsoft's Clang/C2 compiler -- basically this is the Clang front-end, strapped to Microsoft's Code Generator; this gives you a GNU-style compiler (command-line options) that has Clang's level of language support, and creates object files, libraries, and DLLs that are compatible with programs written with Microsoft's normal toolchain. It might be enough for you to do your coursework with. I've used it myself to write code using Boost::Spirit::V3 (a template library that doesn't compile with Microsoft's toolchain).

If your school is a linux house, another good option around the corner is Bash on Ubuntu on Windows -- This is basically the entire Ubuntu user-land running on top of windows, and gives you a full Ubuntu command-line environment right out of the box -- its not "like" Ubuntu, it is Ubuntu -- You can run any Ubuntu binaries you get right from Apt, or you can compile and build from source, just the same as any Ubuntu machine. I believe that's being released to the public with the Windows Anniversary update on August 2nd (based on Ubuntu 16.04), but I'm not 100% certain; you can get it on the fast-ring now though (based on Ubuntu 14.04).

In any event, you'll always want to ensure that your program compiles and runs correctly using whatever environment your work is graded against. Even if you think your code should work and be portable, you don't want to start racking up zeros because you didn't test it.

throw table_exception("(? ???)? ? ???");


Advantages:
- better C++ language standard compliance

Non of there are advantages of non-MSVS nor they are disadvantages of MSVS, as they are easily achievable with the Microsoft compiler.

Microsoft's compiler still lags a bit behind on conformance issues, not much now, but some. There are some language features that can't be fully supported (or at all) until their compiler rejuvenation project is complete. They've written about it on their blog, but the basic problem is that for historical reasons the compiler took things from source to final representation as quickly as possible, so unlike most other compilers there's no intermediate form representation of the entire translation unit, and this makes a few of the new language features very difficult to achieve. Good progress is being made on the rejuvenation though, they announced their SSA optimizer recently, which is a first step in resolving the legacy problem. There is an interim sort of work around, though, that I'll speak to in a bit.

OP:

First, we need to settle on some terms -- A Compiler is the program that transforms your source code to machine code in an object file; notable examples are GCC, Clang, and Cl (Microsoft's compiler). An IDE is the tool many people use to write their source code, manage their projects, debug, and do other things; notable examples (for C++) are DevC++, XCode, and Visual Studio. You don't need an IDE to write code -- you can use any text editor you like, or other IDE-lite offerings -- as long as you're comfortable doing your compiling and linking from the command-line, and with debugging with stand-along tools like WinDBG or GDB. For running your builds, things like MAKE and MSBuild exist -- those allow you to build your program for various targets easily, from the command-line.

For an IDE, Visual Studio Community is probably your best bet right now -- As long as you select the C++ tools during install, everything should be set up. Other IDE options, IDE-lites, and text-editor-based workflows usually require a bit of extra setup.

For the compiler, there are a few things to address -- I'd wager that DevC++ in your instance is pointing to a GCC compiler, or possibly to Clang. Either of these have different command-line options and language support than Microsoft's compiler. If its the case that you'll need to use a compatible compiler for you course-work, you'll need to set them up. Possibly, one option is Microsoft's Clang/C2 compiler -- basically this is the Clang front-end, strapped to Microsoft's Code Generator; this gives you a GNU-style compiler (command-line options) that has Clang's level of language support, and creates object files, libraries, and DLLs that are compatible with programs written with Microsoft's normal toolchain. It might be enough for you to do your coursework with. I've used it myself to write code using Boost::Spirit::V3 (a template library that doesn't compile with Microsoft's toolchain).

If your school is a linux house, another good option around the corner is Bash on Ubuntu on Windows -- This is basically the entire Ubuntu user-land running on top of windows, and gives you a full Ubuntu command-line environment right out of the box -- its not "like" Ubuntu, it is Ubuntu -- You can run any Ubuntu binaries you get right from Apt, or you can compile and build from source, just the same as any Ubuntu machine. I believe that's being released to the public with the Windows Anniversary update on August 2nd (based on Ubuntu 16.04), but I'm not 100% certain; you can get it on the fast-ring now though (based on Ubuntu 14.04).

In any event, you'll always want to ensure that your program compiles and runs correctly using whatever environment your work is graded against. Even if you think your code should work and be portable, you don't want to start racking up zeros because you didn't test it.

Hey Ravyne, thank you for all the information and clarification. I think the term mix up was caused by my professor calling DevC++ a compiler, which I guess isn't entirely incorrect as that is all we used. We do all our work on Windows and so far we just use the one I mentioned. I'm going into my second C++ class next month, so we will see if things change. Since I can access what i need for school over the internet and their virtual desktop, I'm good on that front. I'm more concerned about getting something that will work for personal use so I'm not saving those projects I am doing on my own somewhere other than the school's servers.

This is certainly a lot to go through, but I appreciate it and plan to look into all these options.

MinGW is also available for Windows 10, it is a port of the GCC (default compiler for most Linux distros). There is no IDE and everything is done through the command line, if you're into that sort of thing.
Advantages:
- no IDE means zero start-up time
- better C++ language standard compliance
- no pesky project settings to get lost in
- produces well-optimized code
- (optional) often possible to compile code written for a different platform, but only if you manage to install msys/binutils and such correctly
Disadvantages:
- your IDE is pretty much just notepad
- no microsoft-specific compiler extensions
- no project settings means you have to either manually enter the locations of all libraries and include directories, or get good at MAKE.
- makefiles targetting MinGW are rather more rare in the wild than VS project files, when dealing with projects downloaded from the internet.

I sense a lots of elitism in this comment.

Beginners, people new to c++ should go with the best IDE their platform has, and concentrate on the language (and compiler basics), before going down a route like this. Also, don't forget a good IDE significantly increases productivity, and that's really important in the beginning to avoid turning away the newcomer from a language, because it doesn't have good tooling.

Startup times also not significant, especially not nowadays, when everybody has an SSD in their system. Same things goes for advanced c++ features, beginners won't even understand a fraction of that.

shaken, not stirred

This topic is closed to new replies.

Advertisement