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

To get the most value of this tutorial, we recommend installing an IDE that comes with a C++17 capable compiler.

If you’re restricted to using a compiler that only supports C++14 or C++11 (due to educational or business constraints), most of the lessons and examples will still work. However, if you encounter a lesson that uses concepts from C++17 (or newer) and you’re using an older language compiler, you’ll have to skip it or translate it to your version, which may or may not be easy.

You should not be using any compiler that does not support at least C++11 (which is typically considered the modern minimum spec for C++).

We recommend installing the newest version of a compiler. If you can’t use the newest version, these are the absolute minimum compiler versions with C++17 support:

  • GCC/G++ 7
  • clang++ 8
  • Visual Studio 2017 15.7

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. To do so from the terminal command line, type: sudo apt-get install build-essential.

Arch Linux users may need to install the base-devel package.

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

Q: What do I do if I get a "Can't find compiler executable in your configured search paths for GNU GCC Compiler" error?

Try the following:

  1. If 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.

Other compilers or platforms

Q: 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.

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

Yes, but we don’t recommend it for beginners. You’ll need to find your own editor and look up how to use it elsewhere. Using a command line debugger is not as easy as an integrated debugger, and will make debugging your programs more difficult.

Q: Can I use other code editors or IDEs, such as Eclipse, Sublime, Notepad++, or Visual Studio Code?

Yes, but we don’t recommend it for beginners. There are many great code editors and IDEs that can be configured to support a wide variety of languages, and allow you to mix and match plugins to customize your experience however you like. However, many of these editors and IDEs require additional configuration to compile C++ programs, and there’s a lot that can go wrong during that process. For beginners, we recommend something that works out of the box, so you can spend more time learning to code and less time trying to figure out why your code editor isn’t working properly with your compiler or debugger.

IDEs to avoid

You should avoid the following IDEs altogether because they do not support at least C++11, do not support C++ at all, or are no longer actively supported or maintained:

  • Borland Turbo C++ -- does not support C++11
  • Visual Studio for Mac -- does not support C++

There is no good reason to use an outdated or unsupported compiler when lightweight, free alternatives that support modern C++ exist.

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

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

  • Joseph G

    Cool! Moving forward and feeling encouraged. "Sup Yáll!"...

  • Mohamed

    Done!! Thank you for such an awesome guide

  • Manuel Calzadillas

    Done with this lesson.
    Installed code blocks, let's see how it works
    Good luck you all

  • Pearl

    Can I use turbo C++?

    • Alex

      You _can_, but many of the examples and concepts in this tutorial won't work because the compiler doesn't support C++11. There is no good reason to use an outdated compiler when lightweight, free alternatives that support modern C++ exist.

  • the random guy

    Hopefully my neovim config is up to the task.

  • SS

    DEV C++ is active again.

  • Charles

    I use VSCode + Git Bash + MinGW.  It might be a bit overkill, but it works, and VSCode + Git Bash can be used for many other languages.

  • Scott

    Here's a solution for Windows 10 that I just finished.  I had to get all of the utilities to support it, so it should be complete.

    1)    Download "git" for Windows (https://git-scm.com/downloads and click the Windows link - not the source)
    2)    Run Git-2.30.1-64-bit.exe to install it
    3)    Download the GNU C++ compiler (from CMD, run "git clone git://gcc.gnu.org/git/gcc.git LocalDir"
    4)    I wanted Visual Studio Code, so I downloaded "vscode" from https://code.visualstudio.com/ (this step is probably optional)
    5)    To install the compiler, download MinGW from https://sourceforge.net/projects/mingw-w64/ 6)    Run mingw-w64-install.exe (I used all of the defaults)
    7)    Go into Windows Settings, search for "Edit Environment Variables" and update %PATH (click "New" and add the "bin" directory from your MinGW install dir)

    I think that's everything.  To test it,

    1)    I created a "hello world" program in VSCode
    2)    I selected Terminal/Run Build Task to compile it
    3)    In CMD, I ran the resulting .exe

    I never could get VS Community to work; now I have a running solution!

  • Jandro

    Well, I don't agree with the author, I've tried to get into Visual Studio several times and all of them were an epic failure. It's overwhelmingly complicated and overkill for beginners. VScode is way better, and I think the simpler the better, for which purpose VS is in the other extreme.

    • Kryten

      Had continual problems trying to load Visual Studio which kept failing on package 4 (something.. debugger).So have loaded Code:Blocks instead.

  • Pedro Pedrosa

    I'm using Geany on xubuntu. It's a very light-weighted IDE, perfect for my low-specs notebook.

  • Hillary

    I’m actually learning on my iOS rn
    My laptop got a problem
    Will fix it soon tho
    Anyways is vb.net a good code editor?

  • J34NP3T3R

    how do we update current or install C++ 2020 ?

  • J34NP3T3R

    I have a problem. i followed all instructions.
    but after installation (Default installation path in C:) i still get these 3 folders appeared in my Drive D:

    Program Files (x86)
    ProgramData
    Winmdows Kits

    and when i delete these i get a lot of errors from my compiler including not being able to find an include file.
    why wont these folders appear on the installation folder in C:\Program Files (x86) ?

    • Kelig

      The folder Program Files (x86) appear surrely because you downloaded the 32 bits version of your IDE, if you download the 64bits version, the default repertory will be "Program Files". The "Windows Kits" and "Program Data" folder are normally completely invisible, and you shouldn't delete this folder by hand without a good reason

      • J34NP3T3R

        there is no option to chose x32 x64 versions. it just automatically downloads the vs_community__1175523554.1607990997.exe file.
        where can i download a x32 version ?

  • J34NP3T3R

    A new folder appeared in the drive where i installed visual studio called "Windows Kits" ...
    its 2GB file
    is it safe to delete this folder ?

  • HONGA

    What do you think of the Komodo Editor for C Plus Plus?

  • Gen

    There is also Visual Studio Code now, it's cross-platform. A bit more DIY than Visual Studio, allows a great deal of flexibility

  • Hobs

    One error here. In arch linux you never install anything using the -Syu flags. That can break your system as those are used to update. The correct command is sudo pacman -S *program*

    If you update at the same time as install you might break your linux install.

  • dzzza

    Kindly provide the ^| (up arrow button) is possible to (<- index ->), It helps to read you comments and to back need to rolll all over again to go to next page or back page. I think it will be helpful on all pages.

  • Syafiq Fadillah

    what about and atom? in the article it only says whether atom is good for beginners and c ++ development?

    • nascardriver

      Atom is a text editor, not an IDE. This lesson is about IDEs, because they're easier to use. We're not trying to list all IDEs either, only the major ones. If you want to use anything else, feel free to do so.

  • sam p

    Just wanted to add CodeLite to the list of options.
    I've used it on a Mac with no issues.
    (Unlike CodeBlocks which for me, on a Mac, is horribly unstable. The latest version of CodeBlocks for Mac is pretty old due to lack of development resources for that platform.)

  • B. Downard

    There is a Mac version of Windows Visual Studio now as well if anyone is interested.

  • Lucky Abby

    online compiler https://www.onlinegdb.com support multiple file (.cpp file and .h file) and can be saved too.

  • Kyhou

    Man, I first learned the basic of C++ with Dev C++, a shame it's no longer maintained :/

  • Jeff Tolentino

    I don't have much space on my C Drive, can i still download it without the windows 10 SDK?

    EDIT: The problem is solved now

  • CactusJuice

    Anyone know a good IDE for mac, I'm a beginner but Xcode and Eclipse seem problematic from what I've heard

  • Ahmed

    I downloaded the latest code blocks version and there was no compiler downloaded with it what is the problem and how can I fix it,excuse me if there is any grammatical mistakes.

Leave a Comment

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