Search

0.5 — Installing an Integrated Development Environment (IDE)

As mentioned in the previous section, an Integrated Development Environment (IDE) contains all of the things you need to develop, compile, link, and debug your programs. So let’s install one.

The obvious question is, “which one?”. Keep in mind that you can install multiple IDEs, so there is no “wrong decision” here. During the course of these tutorials, we will be showing you some of the nice features of your IDE, such as how to do integrated debugging. All of our examples will be done using both Microsoft’s Visual C++ (for Windows), and Code::Blocks (for Linux or Windows). Thus we highly recommend you pick one of these.

However, if you would like to try a different IDE, you are free to do so. The concepts we show you will work for any IDE -- however, different IDE’s use different keymappings and different setups, and you may have to do a bit of searching to find the equivalent of what we show you.

Windows IDEs

If you are developing on a Windows machine (as most of you are), then you have two choices:

1) If disk space and/or download size are not a constraint, then we 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++”.

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.

This will take about 6.3 gigs of drive space.

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

The installer that you download off of Microsoft’s web page is actually a downloader. When you run it, it will download the actual IDE from Microsoft and install it.

Note: This tutorial was originally written when Microsoft was distributing the 2005 version of Visual C++. Consequently, some references and screenshots are targeted to that version. Running any later versions (such as 2013, 2015, 2017, etc…) are fine, however, your screens may look slightly different.

Linux or Windows IDEs

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.

Windows users: make sure to get the version with MinGW bundled.

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

Then check the box marked “Have g++ follow the C++11 ISO C++ language standard [-std=c++11]:

Note: If “Have g++ follow the C++14 ISO C++ language standard [-std=c++14]” exists for your version of Code::Blocks, use that instead.

After installing Code::Blocks, some users have been getting an error message “Can’t find compiler executable in your configured search paths for GNU GCC Compiler”. If you run into this, 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 doing a full uninstall, then reinstall.
  3. Try going to settings, compiler, and choose “reset to defaults”.
  4. Try a different compiler.

Alternately, some people prefer to use Bloodshed’s Dev-C++, which also runs on both Windows and Linux.

Mac OSX IDEs

Mac users can use 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.

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.

Moving on

Once your IDE is installed (which is one of the hardest things this tutorial will ask you to do), or if you’re temporarily proceeding with a web-based compiler, you are ready to write your first program!

0.6 -- Compiling your first program
Index
0.4 -- Introduction to development

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

  • Mahendra

    After installing code blocks,in global compiler settings I found the [-std=c++11] and also C++14 ISO C++ language standard [-std=c++14]. According to instructions I selected [std=c++14] and clicked ok. Now whenever I restart code blocks, the toolbar item called “Build Target” becomes faid in colour hence can’t switch between debug & release. Besides this, on restarting, under global compiler settings the [-std=c++14] is now vanished but [-std=c++11] is still there , so I have to check box C++11. On clicking other compiler options under compiler settings [-std=c++14] is showing. Every time when I opens code block the toolbar item called “Build Target” becomes faid or disabled by itself. What is the solution?

    • Alex

      When you start code::blocks, are you reopening a project? The build target should only be available once you’ve done so.

      • Mahendra

        Is that means if I edit any previous program one or more time then I can’t get access to build and release function at the same time. Do I have to make new project again to get build and release function? And what about [-std=c++14] issue? why it vanished and present only in other compiler options tab(under compiler settings)?

        • Alex

          Once you create a project you should be able to reopen it and continue where you left off.

          I can’t speak to why you’re running into these issues, as it appears to be a program or configuration-specific problem. Perhaps ask on a code::blocks specific forum.

      • Mahendra

        Another problem: After making the very first program "hello world" when I press build(ctrl+f9) it shows:

        === Build file: “no target” in “no project” (compiler: unknown) ===

        === Build finished: 0 error(s), 0 warning(s) (0 minute(s), 10 second(s)) ===

        Why “compiler: unknown” is showing in the first line? Although program executes successfully.

        • Alex

          It sounds like your IDE hasn’t been set up properly somehow. If I were you, I’d try uninstalling code::blocks, rebooting, and then try installing again. If you see the same thing, maybe try a different IDE.

  • Moofuqer

    Hello,
    Im using WinXP, and when I install CodeBlocks I keep getting message/notification "Cant find compiler executable in your configured search paths for GNU GCC compiler" - thats my first problem.

    Second is that, when I write a program altho i have this compiler problem, i get this message in CodeBlocks "Debugger" section
    "Error : You need to specify a debugger program in the debuggers´s setting.
    <<For MinGW compilers, its "gdb.exe" (without the quotes)>>
    <<For MSVC compilers, its "cdb.exe" (without the quotes) >>

    Thank You in advance.

  • Im 15, and I’m trying to get a head start on C++ and Java because I want to work at Treyarch(cliche I know lol) but this seems as if it requires previous knowledge of C++. Is this guide good for people that know absolutely nothing(me) about coding or software in general?

    • Alex

      This tutorial does not assume you have any prior programming experience. Everything you need to know, you will be taught along the way.

  • I find Code::Blocks better because that’s the one I find the layout more I guess logical

    • Cameron

      "Learn - Debug": The compiler’s setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.
      Probably the toolchain path within the compiler options is not setup correctly?! (Do you have a compiler installed?)
      Goto "Settings->Compiler…->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler’s setup.

      Heh- right after i say it’s perfect

      EDT I dum nvm

  • barry

    Hello do you still have instruction for visual studio 2015? I just got a new laptop, but I don’t know  what components of visual studio 2015 i should install on my laptop

  • Ray

    Can I use Netbeans for C++? I have seen there is an option for developing C++ programs in Netbeans but the Netbeans Installed in the PC I am using is used for writing Java Programs.

  • adam

    if you ever start coding try this exact code

    #include <iostream>

    int main(){cout << "hello\n";

    }

  • Christoph

    Which Workloads/Individual components should i install with the new Visual Studio 2017 to be able to follow this tutorial ?

  • Rodriguez

    Which program is the best if you’re using a Chromebook provided by the school?

    • mpthompson

      I love my own personal Chromebook, but unfortunately it’s not suitable for learning C++ (or most other computer languages) as it isn’t intended to support applications such as compilers, code editors or IDEs.  With some effort, some Chromebooks are capable of running Linux which is ideal for learning C++, but your school probably has your Chromebook configured in such a way that it can’t be reconfigured in this manner.

      To learn C++, you don’t really need a powerful computer.  Pretty much anything able to run a modern version of Windows (7, 8, or 10) or Linux should be fine.  For instance, if you are somewhat adventurous, you can get a Raspberry Pi 3, install Raspbian Linux on an SD card and run the Code::Blocks IDE to learn C++.  A Raspberry Pi costs less than $40, but you will need to scrounge up a second hand USB keyboard, USB mouse, HDMI monitor and 5 volt power brick to get a complete system running. With some searching around secondhand stores you may be able to put it all together for less than $80. There are tutorials on YouTube and in the Raspberry Pi forums that will guide you through the process of configuring a Raspberry Pi and getting Code::Blocks running.

      • Alex

        You can also use a web-based compiler as an option of last resort. They’re pretty limited, but if that’s all you have access to it’s certainly better than nothing.

  • Kush

    Hey Guys just started with these tutorials and are really looking forward to the rest. I just want to know if anyone recommends QT (my IT teacher at school said he will supply me with a copy cuz internet is really shit where I live). Just keep in mind that I am a complete beginner. I am on a windows machine.

    If you guys recommend QT, do I need to know anything else to use QT or can I just follow the tutorials?

    • Alex

      QT isn’t a compiler, it’s a cross-platform application development framework that’s used with other compilers. QT is a fantastic framework, but you won’t need it for these tutorials.

  • Thanks for IDE tutorial, Going to use xcode. But cannot we use sublime text with some plugin?

    • Alex

      If Sublime supports plug-in compilers (such as gcc/mingw) then yes, you could use it. But you’ll have to figure out how to configure it on your own.

  • vimanyu

    C++ 17 is coming guys!!

  • moot

    It might also be worth adding that Visual Studio Code is now available for any os…

    • Alex

      Visual Studio Code is great, and super flexible, but it’s not easy to set it up to compile programs. Therefore, I can’t in good conscience recommend it to new programmers.

  • Devangshu Mitra

    I am downloading XCODE for MAC OS. Any specific instructions or settings i shall have to enable? Greetings

  • Brian

    Hm, is it okay if I just stick with Vim, GDB and the terminal to write/compile/test/debug programs rather than using an IDE? Kinda want to learn how to work with these rather than use an IDE, at least for now.

  • Neraxa

    Hi.
    I use Visual Studios and when i try to debug my project through the Local Windows Debugger, I get the message:
    Unable to start program, the file was not found.
    I have tried to locate the file manually, but could not find it.
    I have also tried to look for something named ‘compile’ but found nothing.
    Is this the correct way I have tried to start my project, or is there another?

    • Neraxa

      ( I have used both the debug and the release configuration to see if it worked, but it came with the same answer … it would be strange if the file did not exist at all, because it is saved. )

    • Alex

      It should just work. Sounds like something didn’t get set up correctly. Try recreating your project again.

  • Khush

    How to download Visual C++. I have already downloaded Visual Studio Community 2015 for my Window 10 laptop.

    • Alex

      Visual C++ is part of Visual Studio Community 2015. If you didn’t enable that option when you installed, there should be a way to enable it from within the application (from within the create new project dialog).

  • My dear c++ Teacher,
    Please let me say that, recently I found this “ide” online:
    https://www.tutorialspoint.com/compile_cpp_online.php
    It looks to me good. Do you suggest me that?
    With regards and friendship.

    • Alex

      For compiling simple programs, it seems sufficient. However, as with all web compilers, there is no way to debug your programs, so I would not recommend it for anything non-trivial.

      • My dear c++ Teacher,
        Please let me say that, unfortunately, it is not sufficient even for simple programs. It does not execute "std::cin" object. However compiles and executes programs with files, apart object "std::cin".
        With regards and friendship.

        • Alex

          You appear to be incorrect. I was able to compile and execute the following program just fine:

          To enter your input, you need to click on the green console area first to ensure it has focus.

  • rock

    i have ide called turbo c++.Is it an ide and will it work for what we will be doing here.
    and thanks for the website it is awesome

  • lexy

    Time to embark on the journey ahead. I feel this guide will be very fun to follow. I’ll see all of you at the end 🙂

  • Absar

    Hi Alex
    This guide is very good and easy to understand. Well done. My question is that what are the minimum system requirements to program on visual studio express 2013 ? Actually I’m about to go to college to study computer engineering, that’s why I want to learm c   but can’t afford an expensive laptop.

  • RudyR

    Hello there. This site has been quite helpful to me since i missed classes and our teacher memorises the code and teaches us instead of understanding .. so so.
    Anyways it won’t be an issue if i use turbo c++ to do these programs right?
    Thanks again for this wonderful tutorial! Cheers!

    • Alex

      Turbo C++ is a deprecated compiler that does not comply with modern standards. You really should not be using it. You’re better off downloading and installing Visual Studio or Code::Blocks instead (if you can).

  • Liam

    Isn’t c++ usually used to make video games?

  • Patrick McDaniel

    I have code::blocks set up on ubuntu 16.04 and I’m having a lot of trouble with it.  Everytime I try to compile a project it gives the same error "unterminated quoted string"  I can’t find any information on this.  To rule out all possibilities I copied and pasted the code for "Hello world!" and I copy and pasted several other simple programs (inside and outside of this tutorial) as well as manually typing them.  I decided to use Geany as my IDE which was working great until I got to section 1.8 where I could not continue because you can’t make a project with multiple files.

    I think I have some setting wrong in code::blocks I copied and pasted many of the simple programs in this tutorial to both IDE’s and geany worked every time and code::blocks gave me the same "unterminated quoted string" error.

    If anyone can help me it would be greatly appreciated I searched comments on here and I’ve been googling the problem since it started a week or so ago to no avail.

    • Patrick McDaniel

      I solved the problem above ^  its so easy that I can’t believe I didn’t think to try it for so long.  I was saving my projects in a folder called "Patrick’s stuff" and the apostrophe in "Patrick’s" was throwing it off.  Maybe I missed this in the tutorial but it might be worth mentioning.  The only people that I could find with this problem were ubuntu/code::blocks users so it might only affect users with that combination.

    • Alex

      Glad you figured it out. Hopefully this comment will help other readers who encounter the same situation.

  • Garry E

    Alex:
    I see my earlier comment about my difficulties with Codeblocks has disappeared. However, with the help of
    Carl Herolds’ video on You Tube I have finally learned how to manipulate Codeblocks. After the installation
    process is complete and the program is launched the first few screens take you through some housekeeping
    tasks. Then a gray screen appears. Go to menu bar above and click on View menu. Click on Manager. Go to
    Workspace pane on left hand panel. Click on main. "Hello World!" program appears in Editor pane. Go to Build menu above and click on Build/Run. Hello World! appears on output screen. Next, delete what you don’t need from "Hello World!" and type your program in its’ place. Again go to Build menu and click on
    Build/Run. If you have not goofed up, your program should perform as expected. If not there’s
    a ton of stuff at the end of Chapter 1 of this tutorial about what to do next. Which is where I am at now.

    One final comment: deleting a bunch of code to get a clean editor seems like a totally Mickey Mouse way
    to design an IDE!

  • Joey

    XCode is taking forever to install, and as I am 13, I am spending my time typing stupid comments on the Internet!

  • Garry E

    Alex:
    Cheers to you for this great website! I imagine that others have told you that the user interface for
    Codeblocks 16.01 is different than earlier versions and thus your screen shots are obsolete. In particular,
    after the first 3 screens you end up with a gray screen. To get the Management pane you must go to the View
    menu in the Menu Bar at the top of the screen and click on Management. Then, if you entered "Hello world!"
    as the title of your program, sure enough after clicking on main.cpp under the projects tab you do indeed
    get the proper code to generate "Hello world!" on your monitor.

    I have used CB for C coding practice and find it to be very frustrating. For example, if I choose "Console Application" and enter something other than "Hello world!" I have not been able to discover how to get a pure Editor screen. One ploy I have tried is to generate Hello world code, delete that and then write my own code. After that I can debug and compile. After pressing RUN I get one of 2 results: either
    "Hello world!" appears on the screen or "It appears that your file has not been built yet. Do you wish to build it now?" Clicking on yes leads absolutely nowhere! Clearly I’m doing something wrong. I have found
    that a better way is to avoid using Console Application altogether. In the file menu choose New and select
    the File option in the drop down menu. After entering the file path and file name you get the editor for a
    source file. The downside to this seems to be that you can run the program only once. After that the build
    menu shuts down.

    Finally, C coding in Dev.cpp has been less frustrating for me than CB. However, someone wrote a message in the Codeblocks blog saying that the Dev.cpp developer was no longer maintaining the website and they suggested that new users should be aware of the risks before downloading the program.

    • Alex

      What you describe sounds rather strange, but I’m not familiar with the latest version of Code::Blocks. I’ll have to check it out and update the screenshots once I’m back from vacation.

  • GEScott71

    I appear to have successfully installed Visual Studio.  I’m at the start page and it feels like I’m about to enter a new world!

    I am going to install Code::Blocks as well, but I need to free up some more drive space first.  I want to do everything in the tutorial, for a while anyway, on both IDEs as I think it will give me a better foundation going forward. If this is a complete waste of time I’m open to input!

    • Alex

      I encourage you to check out both IDEs. But realistically, once you’ve compiled a few programs with each, there’s probably not much to be gained by continuing to do so beyond that point.

  • Hi Alex,
    I am from India and I really love your lesson’s.
    I just wanted to know that in our institute we are using Turbo C++3.20 for writing programs in c++. Can you Please is it fine to use it with your tutoriols or I need to use this visual c++ ??

    • Alex

      Turbo C++ is very outdated. You would be better off upgrading to a compiler that supports C++11, such as Visual Studio or Code::Blocks. They are both free. If you can not install new software, then perhaps an online compiler would be a viable choice for you (though they make debugging difficult).

      • Our institute is teaching all codes on turbo c++..as i installed code blocks with borland compiler and its running same as turbo c++ codes now.
        But in you tutuorials i am facing problem ‘s,since everything is not explained here. I am beginner just started coding now .
        Its the time to move on right path and with your guidance i think i can fulfill it.
        Please help!

        • Alex

          A few thoughts:

          1) Many times I’ll come back to things later once I’ve covered other prerequisite topics first. So if you don’t see something, keep reading through the lessons. It may be in a future lesson.
          2) Analogy time: If you were learning English, I couldn’t teach you every word in English. There’s just too many words. So I’d focus on giving you fundamentals: key words, plus rules about how to conjugate verbs, that sort of stuff. Once you learn enough of the basics, suddenly you can start learning more by talking to others, by using a dictionary, etc… This tutorial is similar. We won’t cover everything in C++ (that would require a 1000 page book, maybe 2000 if there are lots of examples). But I will teach you lots of fundamentals and context. Then you can go out and learn all the other stuff yourself, using supplemental materials.

  • Erad

    Hi Alex,

    Thanks for this great collection of C++ concepts and topics you have on your site here. I fell in love with your site after reading your explanation on the distinction between the ‘heap’ and the ‘stack.’ By the way, I am a self-taught C++ programmer and have been using the DevC++ IDE to run my programs. But I am disappointed that, for some reason, the current DevC++ IDE I have does NOT have a means to enable the C++11 option!! That is why I’m trying out the Code::Blocks IDE on here.

    I have successfully downloaded and installed the IDE and even run the ‘Hello World’ program. However, I couldn’t find this crucial option under Settings->Compiler-> "Have g++ follow the C++11 ISO C++ language standard [-std=C++11]" This is the text enclosed in the red rectangle in your literature.

    Please how can I get this very much needed C++11 option enabled?

    • Alex

      You may have downloaded the wrong version of Code::Blocks. Have a read of some of the answers here and see if they help.

      • Erad

        I downloaded the "codeblocks-16.01mingw-setup.exe" version from the Code::Blocks link in your literature. I would think that’s the correct one to download. Right?

        I checked the link you provided in your reply; the post on there is actually the same problem I encountered. That "Have g++ follow the C++11 ISO C++ language standard [-std=C++11]" is curiously missing in the Settings->Compiler settings->Compiler Flags path!! One entry on the StackOverflow site suggests using the " …[-std=C++0x]" option. I am yet to try that to see how it works out.

        • Alex

          Yes, the 16.01mingw version should have a C++11 compatibility mode.

          I’m not sure what else to suggest. Please respond back if you find a solution, so that other readers who encounter this can be helped.

          • My dear c++ Teacher,
            Please let me say I had same problem with codeblocks-16.01mingw-setup.exe for  Windows XP / Vista / 7 / 8.x / 10. I used " …[-std=C++0x]" option but does not work.
            Hopefully Dev-C++ 4.9.92 works!
            With regards and friendship.

Leave a Comment

Put C++ code inside [code][/code] tags to use the syntax highlighter