Search

0.6 — 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, IDEs 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 IDEs 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.

Tip

You’ll want to install an IDE that has a C++11 capable compiler, as this tutorial assumes C++11 as a baseline level of 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. 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

For Linux users

Some linux installations may be missing dependencies needed to run or compile programs with Code::Blocks.

Debian-based Linux users (such as those on Mint or Ubuntu) may need to install the build-essential package From the terminal command line, type: sudo apt-get install build-essential.

Arch-linux users may need to install base-devel, which can be done via pacman -Syu base-devel.

Users on other Linux variants will need to determine what their equivalent package manager and packages are.

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 installations seem to cause their 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.7 -- Compiling your first program
Index
0.5 -- Introduction to the compiler, linker, and libraries

498 comments to 0.6 — Installing an Integrated Development Environment (IDE)

  • Ethanicus

    So far so good! Downloading C++ 2010 right now.

    • Alexandra

      Hello,
      I have a question for you. When you instaled it (C++ 2010_, have you seen the box for Microsoft MSDN? I am asking because I didn`t, and I would to know if this is something normal or not. Thank you.

  • jacwib

    This was the easiest step. Seriusly, i just did

    . That was easy.

  • cheapy

    The Orwell Dev-C++ IDE (took over the Bloodshed one) works and is available for free at

    http://sourceforge.net/projects/orwelldevcpp/?source=dlp

    I would suggest trying that rather than other ones where the syntax isn't exactly correct especially if you are a beginner.

    • cheapy

      Actually, the instructions are clearer for code::blocks and all you need to do to install it is follow the link, go to downloads and select the one for your system.

  • shiki

    hello guys , this is a very noob question ,i know , but i just started here yesterday and i find this incredibly helpful but i encounter a problem when downloading visual c ++ express edition compiler . when i go to the site it says microsoft visual studio . is that the same thing . i d really like to be sure XD .

  • Krazh

    Starting using this site yesterday and so far I love it! Great job!

    I was just wondering how you actually end up with a program that you can run in windows? I'm using Visual Studio Express 2012.
    When I was working on my MacBook it wasn't a problem as I could simply type 'make' in the terminal :)

  • mona

    Will Visual C++ 2010 Express Edition be ok to install as i am a complete beginner and have windows vista? or should i install the recommended 2008 version? i'm wondering if it will run on vista since a commenter complained that it didn't.

    btw, this is an amazing free resource. you have my eternal gratitude.

  • Mena

    Um...so I installed MS Visual Basic 2003. is that okay?

  • Hello, for slackware users, i currently use slackware 13, you may install Code::Blocks from here http://slackbuilds.org/repository/13.0/development/codeblocks/ and dependences from slackbuilds.org too. Geany (Recommended) is simple but fast for short examples, you can download from slackbuilds.org. I dont recommend Bloodshed DEV-c++ for windows is too old instead you can use wxDev-C++ download here http://wxdsgn.sourceforge.net. Bye

  • fero45

    For the very beginning, to test simple code, I would also recommend Geany editor. It runs under Win and Linux. It's got an in-built terminal. I use it for scripting and testing my scripts in PHP and Perl under Linux.

    Write some code, hit F8 (compile) then F9 (build) and then F5 (execute). In two seconds you can see your output in the terminal. Change your code and hit the function keys again. In a minute you can test your code a couple of times.

    Linux users have to install g++

    Of course, install Code::Blocks under Linux too :-)

  • Dicennian

    Nice that these things are free. Probably the first tutorial I will ever follow where it feels like if I have the same program xD

  • Space_Knite2

    I Like these tutorials, usually i end up sitting at my computer, staring at huge (and i mean HUGE!) mindless scripts and texts which never really work

    at least this tells you what you need to do accurately, rather than placing you in the middle of something completely alien to you.
    And in answer to your question Noha, the writer of this stated the only difference is the window organisation (the screen of the program is arranged differently)

  • Monco

    I prefer Microsoft Visual Studio 6.0 IDE.
    i'm using Visual Studio 6.0 and I never had problems so far. It's very comfortable and reliable. Works with Windows 95/98/2000/Me/XP.

    • I used Visual Studio 6.0 for a long time. Was a good product. The downsides of it are:
      1) It's not free
      2) It only has a partial template implementation, so a lot of modern template code doesn't work on it.

  • ANshul

    hi i am downloading the 2008 microsoft version of c++ express its 96 mb is it the right thing ?and do i require some sql thing

  • I liked Michael's comment about bloodshed DEV-c++. Every computer on my school campus has Bloodshed DEV-c++ installed on it. It seems to be very popular for both Windows and Linix (I think it can even be used on Macs but I am not sure). It looks like it is the new hit program to work with C++

  • Rudy

    Alex, I have used this site for a few months now (great tutorial!) and have just now registered to ask this. I can't seem to find anything on how to turn on line numbering. Every example you have has numbers in it and it would be helpful for me to start using it. I've looked everywhere though! I am using the suggested Microsoft Visual C++ 2008 Express. This seemed like the best place to post this so I hope you will find it and help me out. Thanks!

    • Sorry it took me so long to respond. The line numbering is done on this website by a special plugin. I think you can get line numbers in MS C++ 2005 by going to Tools->Options, open Text Editor, select "All languages", and check the line numbers checkbox.

      Not sure whether it was moved in C++ 2008 or not.

      • ntt

        The line numbering is turned on exactly the same way in the 2008 version.

        Thanks for a great tutorial. At last, a tutorial that treats you like a beginner not an idiot.

  • Pieter

    Damn, will have to wait to get home before i can get the IDE, can't use up all the companies cap :)

  • Does anyone know why Code::Blocks is giving this error message?

  • Stefan

    > So is Eclipse ok?
    sure is ok, it's quite professional, but is way too slow comparing to dev++ or code::blocks, but if that doesn't mind you feel free to try NetBeans is way friendlyer in C++ comparing to eclipse.

  • thanks Alex for this great tutorial .
    i was learning JavaScript and i found c++ interesting subject.
    i hope your tutorial will help enough. thanks for sharing

  • Michael

    when i downloaded the Microsoft download thing it was ok but i opened it it kept saying lost connection to the server so i got bloodshed DEV-c++ instead i was wondering if this was the best choice besides Code::Blocks.

  • Dylan

    Whew! It took about an hour but I finally downloaded Xcode. I can't wait to make my first program!

  • Another great section of the tutorial. Thanks for the feedback on which IDE is most helpful.

  • John

    Great job, I love the site so far. I'm hoping the next tutorials will be as easy to understand as these.

  • Masss

    Wow, this site is so amazing thus far, and I'm sure will continue to amaze me! I just had a question!

    In this tutorial, you suggest the download of Microsoft's Visual C++ 2005 Express Edition for the window users, but what about this new 2008 version? Would it all work out the same way?

    Thank you for putting this site up.

  • I installed Microsoft Visual Studio Express 2008 and have tried the hello world program in this tutorial, but it dosent work, it says the system cannot find the path specified, (when i try to run it with ctrl f 5) also before that when i click on build solution it says the file is out of date, it also says that when i try to write "game" in the microsoft tutorial. Do you have any suggestions? Thanks!

    • I am not sure what would cause this. Sounds like some of your paths are set incorrectly. Does it compile and not execute? Or does it not even compile?

  • If anybody reading this is a linux newb like me using mandriva. You can just

    as root and then run it by typing codeblocks.

    And thanks for this awsome guide

  • Jamal

    Is that OK to install C++ Visual 2008 instead of 2005 which not available on microsoft site.

  • jestuart

    I have been looking for a site that taught C++ usuing MS Visual Studio. LearnCPP.com pops up when searching for C++ tutorials but didnt pop up for me when I was searching for C++ tutorials usuing MS Visual Studio. I am gald I read this far, because now I am excited. The site seems very upto date in content so far and is usuing the compiler and environment I was looking for.

  • Grant

    I will be installing XCode on my Mac ASAP!

    (does anyone read these things?)

Leave a Comment

Put all code inside code tags: [code]your code here[/code]