Search

0.5 — Installing an Integrated Development Environment (IDE)

An Integrated Development Environment (IDE) is a piece of software that contains all of the things you need to develop, compile, link, and debug your programs.

With a typical C++ IDE, you get a code editor that does line numbering and syntax highlighting. Many (but not all) IDEs include a C++ compiler and a linker, which the IDE will know how to interface with in order to convert your source code into an executable file. And when you need to debug your program, you can use the integrated debugger.

Furthermore, IDE’s typically bundle a number of other helpful editing features, such as integrated help, name completion, auto-formatting, and sometimes a version control system. So while you could do all of these things separately, it’s much easier to install an IDE and have them all accessible from a single interface.

So let’s install one! The obvious next question is, “which one?”. Many IDEs are free (in price), and you can install multiple IDEs if you wish, so there’s no “wrong decision” to be made here. We’ll recommend a few of our favorites below.

If you have some other IDE in mind, that’s fine too. The concepts we show you in these tutorials should generally work for any decent modern IDE. However, various IDE’s use different names, layouts, key mappings, etc… so you may have to do a bit of searching in your IDE to find the equivalent functionality.

Visual Studio (for Windows)

If you are developing on a Windows machine (as most of you are) and disk space and download size are not a constraint, then we strongly recommend Visual Studio Community 2017. When you run the installer, you’ll eventually come to a screen that asks you what workload you’d like to install. Choose Desktop development with C++. If you do not do this, then C++ capabilities will not be available.

The default options selected on the right side of the screen should be fine, but please ensure that the Windows 10 SDK is selected. The Windows 10 SDK can be used on older versions of Windows, so don’t worry if you’re still running Windows 7 or 8.

Visual Studio Workload

If disk space and/or download size are a challenge, then we recommend Microsoft’s free Visual Studio Express 2017 for Windows Desktop, which you can find towards the bottom of the page.

Code::Blocks (for Linux or Windows)

If you are developing on Linux (or you are developing on Windows but want to write programs that you can easily port to Linux), we recommend Code::Blocks. Code::Blocks is a free, open source, cross-platform IDE that will run on both Linux and Windows.

For Windows users

Make sure to get the version of Code::Blocks that has MinGW bundled (it should be the one whose filename ends in mingw-setup.exe). This will install MinGW, which includes a Windows port of the GCC C++ compiler:

Code::Blocks MinGW Windows download

When you launch Code::Blocks for the first time, you may get a Compilers auto-detection dialog. If you do, make sure GNU GCC Compiler is set as the default compiler and then select the OK button.

Compilers Auto Detection dialog

With Code::Blocks, C++11/C++14/C++17 functionality may be disabled by default. You’ll definitely want to check and turn it on. First, go to Settings menu > Compiler:

Code::Blocks Settings > Compiler

Then find the box or boxes labeled Have g++ follow the C++XX ISO C++ language standard [-std=c++XX]:, where XX is 11, 14, or some other higher number (see the items inside the red box below for examples):

Code::Blocks C++11 setting

Check the one with the highest number (in the above case, that’s the C++14 option inside the red box).

Your version of Code::Blocks may also have support for experimental, or just released versions of C++. If so, this will be labeled Have g++ follow the coming C++11YY (aka C++XX) ISO C++ language standard [-std=c++ZZ] (see the blue box above). You can optionally check these if you would like to enable features in that version, but note that support may be incomplete (e.g. some features may be missing).

Q: I want to enable C++17 features in Code::Blocks, but I don't see a -std=C++17 option

If you see an option for -std=C++1z, that is equivalent (C++17 was called C++1z before they knew what year it would be finalized).

Alternatively, you can go to the Other Compiler Options tab and type in -std=c++17.

Code::Blocks Other Compiler Options

This will work if your compiler has C++17 support. If you’re using an older version of Code::Blocks and C++17 features don’t seem to work, upgrade your compiler.

Q: I'm getting a "Can't find compiler executable in your configured search paths for GNU GCC Compiler" error

Try the following:

  1. In you’re on Windows, make sure you’ve downloaded the version of Code::Blocks WITH MinGW. It’s the one with “mingw” in the name.
  2. Try going to settings, compiler, and choose “reset to defaults”.
  3. Try going to settings, compiler, toolchain executables tab, and make sure “Compiler’s installation directory” is set to the MinGW directory (e.g. C:\Program Files (x86)\CodeBlocks\MinGW).
  4. Try doing a full uninstall, then reinstall.
  5. Try a different compiler.

Mac OSX IDEs

Popular Mac choices include Xcode (if it is available to you), or Eclipse. Eclipse is not set up to use C++ by default, and you will need to install the optional C++ components.

Although Visual Studio for Mac has been released, as of Aug 2018 it does not support C++, so at this time we can not recommend it.

Can I use a web-based compiler?

Yes, for some things. While your IDE is downloading (or if you’re not sure you want to commit to installing one yet), you can continue this tutorial using a web-based compiler, such as the one at TutorialsPoint.

Web-based compilers are fine for dabbling and simple exercises. However, they are generally quite limited in functionality -- many won’t allow you to save projects, create executables, or effectively debug your programs. You’ll want to migrate to a full IDE when you can.

Can I use a command-line compiler (e.g. g++ on Linux)?

Yes, but you’ll need to find your own editor and look up how to use it elsewhere.

When things go wrong (a.k.a. when IDE stands for “I don’t even…”)

IDE installation seems to cause its fair share of problems. Installation might fail outright (or installation might work but the IDE will have problems when you try to use it due to a configuration issue). If you encounter such issues, try uninstalling the IDE (if it installed in the first place), reboot your machine, disable your antivirus or anti-malware temporarily, and try the installation again.

If you’re still encountering issues at this point, you have two options. The easier option is to try a different IDE. The other option is to fix the problem. Unfortunately, the causes of installation and configuration errors are varied and specific to the IDE software itself, and we’re unable to effectively advise on how to resolve such issues. In this case, we recommend copying the error message or problem you are having into a Google search and trying to find a forum post elsewhere from some poor soul who has inevitably encountered the same issue. Often there will be suggestions on things you can try to remedy the issue.

Moving on

Once your IDE is installed (which can be one of the hardest steps if things don’t go as expected), or if you’re temporarily proceeding with a web-based compiler, you are ready to write your first program!

0.6 -- Creating a console project and compiling your first program
Index
0.4 -- Introduction to C++ development

205 comments to 0.5 — Installing an Integrated Development Environment (IDE)

  • So I'm making a video game, and the game engine I'm using is based off c++(Unreal Engine 4). Just wondering will learning all of this benefit me on making my videogame?

  • Volker

    I've installed Visual Studio Community 2015 but wasn't aware it's a limited trial for 30 days?
    Guess I'll go with Code:Blocks instead, unless you have any comments regarding that apparent registration/purchase of Visual Studio, Alex?

  • Dav

    Hello, after I downloaded the Visual Studio 2015 and tried starting a new project. The template for C++ doesn't appear. It only shows C# and Visual Basic.

    I tried modifying, and then uninstalling the whole thing. Double checking that I chose the C++ from the setup page. Still, the option for the C++ template doesn't appear.

    Help please?

    • Alex

      I'm not sure why this is happening. Sounds like a bug in Visual Studio maybe.

      Two things to check:
      1) Did you ensure that the "Common Tools for Visual C++ 2015" subitem was checked when you installed?
      2) Try running "devenv /InstallVSTemplates" from the command line as an admin and see if that's able to fix things.

      If neither of those address the issue, the only thing I can suggest is maybe searching Google for an answer. I wasn't able to come up with anything definitive.

  • Lucas

    i don't have much disk space and my download doesn't start (using windows 10)

  • Charley

    Hi there,

    I am about midway through the tutorial now. You've done a great job.

    There is one question though. I am trying really hard to get away from Microsoft. What would you recommend for building a C++ based GUI program for Windows?

  • kingrubi

    hey u can use Notepad++ very light software but can help in programming too :D

    • Alex

      Notepad++ is a fantastic editor, however I don't recommend it for new programmers writing C++ applications because you have to set it up to work with a compiler (minGW) manually. You're better off installing something that comes with a C++ compiler set up out of the box.

  • Sanjiv Prasad

    I will be using the 2015 Visual Studio RC available for Windows 10 Previewers. It downloaded with about 20 other programs. Are these other ones necessary? Also, it came with a package referred to as Blend. Do you know what it does?

    • Alex

      I don't think most of the other programs are necessary, but I also don't see any way to not install them. :( It looks like Microsoft has taken to bundling in a bunch of miscellaneous stuff to get wider adoption.

      Blend is an application to develop user interfaces for web and desktop applications.

  • Ivan

    Hi,
    I'm newbie in c++, and I have a question about general architecture behind c++ compiler, linker etc. implemented in Visual Studio (I don't know why it actually bothers me, let say just my curiosity). As I got it from Wiki and other discussions in stuck-overflow threads that languages like Java and C# use virtual machine that compile code into sort of 'common intermediate language' and then this CIL-code into native machine code. This procedure has been introduced (as i understood it, i might got it wrong, correct me if i'm wrong here) in order to prevent incompatibility of written code with hardware of various devices, that may happen if you use just compiler (w/o virtual machine). Thus, the question is how does it work with c++ in VS? Is code compiled in to native machine code or it's done via virtual machine?
    Thank you.

    • Alex

      Native C++ is compiled directly to native machine code. There's no intermediary language. This is part of what makes C++ fast. The downside is that C++ programs need to be recompiled for each target architecture.

      For languages like Java and C#, those languages are compiled into an intermediary language. When the Java or C# app is run, the intermediary language is compiled just-in-time to produce an application that can run on the target architecture. The advantage of this approach is that one program can work on any architecture that supports the just-in-time compiler. The downside is that there's a performance cost.

      Microsoft does provide a C++-similar language called C++/CLI that's meant to be compiled into an intermediary language instead of directly to native code.

  • Adam

    The Visual Studio website lists 'Visual Studio Community 2013' alongside the 'Visual Studio Express 2013 [for Windows Desktop etc]'. After doing some Google research the 'Community 2013' IDE seems like a much better choice than 'Express', with several features that 'Express' does not have. I can't see why you'd recommend Express over Community, so could someone please clear this up for me?

    • Alex

      Mainly because Express is smaller. If you aren't worried about bandwidth or hard drive space, you're welcome to get the more powerful Community version instead.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">