Get Started with C++
This tutorial is about how to get started with coding C++ on a windows computer, using open source tools.
Before you start reading: I am not a senior coder; this tutorial is for beginners.
C++ is a compiled programming language, that means the sourcecode gets compiled into an executeable.
Thus, to code in C++, you will need a compiler
, that generates programs out of C/++ sourcecode.
In this tutorial we will setup the mingw compiler, and use Code::Blocks as an IDE (Integrated Developement Environment).
So folks, what do we need to get started?
I have chosen to download the automatic MinGW installer.
Thats a small application that will download and install MinGW for you.
While choosing components, I also activated make for MinGW and g++. I am not quite sure, but I think we might need that.
Installing Code::Blocks is easy as well.
I chose the binary windows package without MinGw. It seems possible to just use the package that includes MinGW, and skip installing MinGW yourself.
When running Code::Blocks first time, it will prompt you about the default compiler to use. Here you choose Gnu-GCC-Compiler (which should be autodetected).
If MinGW gets not detected, you have to set it up manually, which is easy, so dont worry. Go to the menu, Settings->Compiler and Debugger, select the gcc compiler and edit the toolchain executables (make it point to your MinGW directory).
Compiling hello world
Ok. lets try out if we can compile a program, to check if we set things up properly.
For that you create a new project, a Console Application. A console application will pop up a dos box.
Check out the build menu. there you can clean up compiled stuff, as well as compile new.
I suggest you to select Build->Clean, and afterwards Build->Build and Run. The sourcecode should compile without error, and display the string "Hello World!" in a black dos box.
This page has been viewed 13038 times.