The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Dev-C++

From Allegro Wiki
Jump to: navigation, search

Dev-C++ (a.k.a. Dev-Cpp) is an open source IDE coded in Delphi. It supports most GCC based compilers, and comes with MinGW. There are also installers that don't contain a compiler, and thus you can easily switch to Cygwin etc.


Features

It has all the basics: custom syntax highlighting, profiling and debugging support, class browsing, CVS support, and more. Its most notable feature is its low profile; the entire thing (MinGW included) extracts to about 90MB! This is impressive when you compare it to the insane amount of time and disk space required to install a Microsoft compiler of any caliber.

Dev-C++ comes with a really cool feature called Dev-paks. You can use the IDE's built in updater to search for dev-paks. If you prefer to look for them yourself, there is a little site called http://www.devpaks.org! Remember that there is no 'c' or dash when typing in the URL. See the Using DevPaks section below.

Downloading/Installing

I highly recommend NOT using the latest version, as it is still in beta and spurts errors unexpectedly. If you like software testing while you code, you can download it along with the old versions at http://www.bloodshed.net/.

A walkthrough detailing how to install Dev-C++ and Allegro can be found here: http://www.gamedev.net/community/forums/topic.asp?topic_id=354954&whichpage=1&#2508388

TODO: Write a hard version to have here, instead of an external link (edit)


Setting up Allegro

Windows needs DirectX to run Allegro (to my knowledge). Dev-C++ comes with some dated DirectX headers and libraries, which may or may not need replacement. Since A4 uses DirectX 7, it is doubtful that replacement is necessary for an Allegro program. If you do need it you can download a MinGW copy of DX7 here.

Making an Allegro Project

  1. Click "File", "New", and "Project..."
  2. Select "Empty Project", give it a name, and click OK.
  3. Save your project somewhere (I recommend using a separate folder for each project).
  4. Right-click on the name of your project (in the left sidebar) and click "Project Options".
  5. Click the "Parameters" tab, and click "Add Library or Object"
  6. Find the "liballeg.a" file, usually under "/allegro/lib/mingw32".
  7. Click the "Directories" tab, click "Include Directories", and click the Folder Icon on the right.
  8. Find the "/allegro/include/" folder and click OK.
  9. Click "Add" then press OK.
  10. Click "File", "New", "Source File" then click Yes.
  11. Write your program here, then save and compile.
  12. If you are using MinGW don't forget to put END_OF_MAIN() after the main function.

Alternatively, I usually install Allegro libraries to the default library directory ("/lib/"), and the headers to the default header directory ("/include/"). This way, setting the include and lib directories is not necessary for creating a new project, and this makes setup a little easier.

Using DevPaks

Once you have Dev-c++ installed, you can download a package that will automatically install itself. These are called DevPaks and are the neatest thing since potato bread. They allow even the most inexperienced (or lazy) programmer install a library for the MinGW compiler. Allegro isn't the only library available for download; other libraries like libPNG, lame enc, DX 9c, and more are pre-made for your installation pleasure.

  1. Click the Tools menu at the top of the window, then click Check for Updates/Packages.
  2. When the next menu comes up, click Check for Updates at the bottom. (If nothing appears try changing the DevPak server you are using by clicking on the drop-down menu at the top of the updates window.)
  3. Find allegro by clicking the Update box just above the updates twice so that updates starting with 'A' are shown.
  4. Check Allegro and then click Download Selected.
  5. Once it is done, go through the installation wizard.