Download the Compiler/IDE


First, download Dev-C++, which includes both the compiler and the IDE. The compiler included is called Mingw/GCC, and is the software that translates typed C++ code into a runnable computer program. The IDE, or Integrated Development Environment, which makes typing/reading computer code easier to work with in project form. Click here to download Dev-C++ 5.0 with Mingw/GCC


Run the setup program once it has finished downloading.


Step through the install process until it has completed, then open Dev-C++. If you skip opening it at the end of the install, you can open it through the Windows Start menu via a folder for Bloodshed Dev-C++ that should have appeared after installation. (If you're curious, here is why it is called Bloodshed Software - it has nothing to do with violence!)


Compile your first program


Start a new Empty Project by going to File then New Project. I suggest creating a new folder for your projects somewhere (desktop, or in the Dev-C++ folder) called Projects, and creating a new folder for this project within that new folder. We'll call this first project's folder FirstProj. By keeping all of the project's source files in that folder, alongside the .dev project file, it will be easier to keep track of all the pieces to make backups, transfer the project to a new machine, etc.


Add a new file to the project by going to New then Add a New Source File.


Type this into the new blank file:


#include <stdio.h>
#include <stdlib.h>

int main() {

printf("This is the text output of my first program.\n");
printf("It can say anything I wish.");
system("PAUSE");
return 0;

}


Go to File, then Save As, and save your new source file as "main.cpp" inside your project's folder.


From the menus, go to Execute then Compile.


Run it


Try running FirstProj.exe (or whatever name was output, matching what you named your project) from your project's folder.


Congratulations, you're a programmer! Now read up on C, then C++, trying things out as you go... here are many free online books about programming languages, including C and C++.


Are you not entertained?


Ok, so this probably seems like a way too much work to get a computer to display a short message in text. And it is. But here's the exciting part: simply by typing different code into your project's source file(s), you can make a computer do anything that a computer can do. This is how Call of Duty 4, Super Mario Galaxies, Firefox, Microsoft Office, and every other piece of software that you've ever used on an electronic device gets made. Much older stuff was made in a different language than C/C++ (versions of Assembly, if you're curious), and mobile games or web applications use variations of C/C++ (Objective-C, Java, ActionScript...) that have the same fundamentals.


If the prospect of learning a new language seems scary, don't fret! A programming language is waaaaay simpler than learning a human language. The vocabulary is often less than a couple of dozen keywords (6-10 of which you'll use with any regularity), there are only a few grammar rules which are extremely consistent, and there's no slang/dialect/idioms to pick up. You can pick up the basics in no time, and once you have that you'll see that even the most complicated programming stuff is all just patterns rearranging those same basic elements.


Questions, or running into trouble? Here is the Dev-C++ FAQ. If you tried to follow along but got stuck, if it didn't work and you're sure you followed the steps, if you're on Mac and really wish I wrote a version of this page that would work for you, please

e-mail me at chris@gamedevlessons.com with your question. I'll answer your question by updated/fixing this page, and my answering your question can help make a difference for the thousands of people that view this page after you do (including those too shy to ask their own questions).


Graphics, audio, mouse/joystick input...


When you're ready to start drawing shapes, displaying images, taking mouse input, playing sounds, and doing other videogame related stuff, in Dev-C++ go to "Tools" then "Check for Updates/Packages", then under "Select devpak server" choose "devpaks.org Community Devpaks". Press the "Check for Updates" button, then check the boxes to install Allegro (the library for audio, input, and graphical functions) and Allegro Supplement (documentation and sample files). The sample files will show up within your Dev-C++ install folder (browse for Allegro and Example/Sample folders), providing isolated examples of how to do different things that you'll want your program to do.


Examples Update: I've put together a set of simple example Allegro source files demonstrating some basics for how to get an object moving around the screen using keyboard input using Allegro. Although the source folders include the Dev-C++ .dev project files and associated data, the most important parts are the .cpp and .h files provided. The source is undocumented at this time, but it's minimal enough to be mostly self-documented, and the Allegro documentation should be enough to make sense of it. The Allegro sample files show all that's needed to play sounds or display images within the provided simple game loops.


E-mail me via chris@gamedevlessons.com.