Tuesday, May 19, 2009

Setting up for C++

The first step in programming C++ is to choose an IDE. An IDE is an integrated development environment. It is a program that will let you program, compile, link, and execute your programs.

There are four popular IDE's for programming with C++:
  • Microsoft Visual Studio
  • Borland C++ Builder
  • Dev-C++
  • Programmer's Notepad
I have to recommend Dev-C++ as the best IDE for C++ beginners. It is extremely easy to set up and get code running quickly. It also comes with unrivaled makefile support. You don't even have to look at the makefile when writing simple C++ programs.

The rest of this post/tutorial will cover writing, compiling, linking, and running a simple C++ program with Dev-C++. However, the steps presented here should be similar to follow compared to those in another IDE.

The first step, obviously, is to download and install your IDE. Dev-C++ can be found here on their website. Once it's been installed correctly, run the program. It should load up pretty quickly.

Now go to the "File" drop down, and choose new source file. Copy and paste the program here into your IDE. Then go to the drop down window "Execute", and select "Compile and Run". You will be prompted to save your program. It doesn't matter what you save it as, just make sure you save it with the .cpp extension. (For example, helloworld.cpp)

If you've down everything right, a black console window should open up and say "Hello World!". Press a number and then press ENTER to close the window.

Congratulations! You just made and ran your first C++ program!

2 comments:

  1. My IDE says Unresolved Inclusion:

    ReplyDelete
  2. You're probably missing the # before #include

    ReplyDelete