Installing Allegro - Dev-C++

Started by
16 comments, last by nghiale 14 years, 1 month ago
I know there are things all over the internet about this, and i'm sure this comes up a lot on these forums, but it's my first time and I need help. I'm trying to set up Allegro for use with my Dev-C++ compiler. I've been all over the http://www.allegro.cc, sourceforge.net/project/screenshots.php?group_id=2435, and http://www.mingw.org/ pages time and time again. I try to follow the steps, but the instructions for what to download next are so confusing. I think that pages have changed and files have moved since the writing of the instructions. I think i've managed to get some progress. Here's what i've done: Since the links on http://www.allegro.cc/files/install-devcpp.html at step 2 under "Step by Step" are screwy and the directions are confusing, I found on http://prdownloads.sourceforge.net/mingw a download for "MinGW 5.0.0", which I took to be the latest full download for MinGW. After downloading this, I went into the DOS Prompt step of testing the installation and compiling Allegro. Here is what I see: http://img.photobucket.com/albums/v497/furinto/prompt.jpg I get an error... and I don't know what's wrong or how to fix it. So! My question here is this. Can anybody give me an up-to-date, step-by-step guide to installing Allegro (and/or MinGW) for Dev-C++? It's just that I feel like out-of-date instructions and links are what's confusing me.
Advertisement
Just read allegro/docs/build/mingw32.txt

Also, you don't need to download MinGW if you got it with Dev-C++ (one with 9 MB installer).
I'm not sure if my version of Dev-C++ came with MinGW, because it was on a CD that came with my Beginning C++ Game Programming book.
Quote:Original post by furinto
I'm not sure if my version of Dev-C++ came with MinGW, because it was on a CD that came with my Beginning C++ Game Programming book.

Dev-C++ is an IDE that can be used with any GCC based compiler, like Cygwin. But it used MinGW by default, so yes, it comes with it. Like the link says, you need to update it a tad though. That page is pretty straight forward. I forget what generates that error you posted though. Don't you have to rename make or something?

Jesus saves ... the rest of you take 2d4 fire damage.

Well, the previous reply I made was a little dumb of me - disregard it xD

However, I went through and uninstalled everything - allegro, dev-cpp, and mingw, and went through the directions in docs\build\mingw32.txt from scratch. The only thing I didn't do was downlaod the directx 7.0 sdk (dx70_mgw.zip at allegro's sourceforge site) because I already have the 9.0 SDK.

I went through the steps in the command prompt:

1. "gcc -v" - worked
2. "fix" to set it up - worked
3. "make" - this time it actually did something, instead of giving me an error, it started compiling. I was happy because I though I finally fixed it - but towards the end of the compiling, it started showing all these "warning" and "error" messages, about 30 of them before stopping. I tried doing the next step, typing in "make install" and once again I get a bunch of errors and warnings.

Something still isn't working, and I don't know what.

I'm kind of new to the tags this particular forum uses, but i'll use a &#106avascript tag to paste the message from the command prompt so that it doesn't make this post long.
C:\Dev-Cpp\allegro>makeCompiling Allegro for MinGW32, optimised. Please wait...gcc -DALLEGRO_SRC -Wall -Wno-unused -mcpu=pentium -O2 -funroll-loops -ffast-math  -fomit-frame-pointer -fno-strength-reduce -I. -I./include -o obj/mingw32/alleg/wddaccel.o -c src/win/wddaccel.c`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.In file included from src/win/wddaccel.c:[23]:src/win/wddraw.h:[29]:[22]: ddraw.h: No such file or directoryIn file included from src/win/wddaccel.c:[23]:src/win/wddraw.h:[38]: error: syntax error before "directdraw"src/win/wddraw.h:[38]: warning: type defaults to `int' in declaration of `directdraw'src/win/wddraw.h:[38]: warning: data definition has no type or storage classsrc/win/wddraw.h:[39]: error: syntax error before "dd_prim_surface"src/win/wddraw.h:[39]: warning: type defaults to `int' in declaration of `dd_prim_surface'src/win/wddraw.h:[39]: warning: data definition has no type or storage classsrc/win/wddraw.h:[40]: error: syntax error before "dd_clipper"src/win/wddraw.h:[40]: warning: type defaults to `int' in declaration of `dd_clipper'src/win/wddraw.h:[40]: warning: data definition has no type or storage classsrc/win/wddraw.h:[41]: error: syntax error before "dd_palette"src/win/wddraw.h:[41]: warning: type defaults to `int' in declaration of `dd_palette'src/win/wddraw.h:[41]: warning: data definition has no type or storage classsrc/win/wddraw.h:[42]: error: syntax error before "dd_caps"src/win/wddraw.h:[42]: warning: type defaults to `int' in declaration of `dd_caps'src/win/wddraw.h:[42]: warning: data definition has no type or storage classsrc/win/wddraw.h:[43]: error: syntax error before "dd_pixelformat"src/win/wddraw.h:[43]: warning: type defaults to `int' in declaration of `dd_pixelformat'src/win/wddraw.h:[43]: warning: data definition has no type or storage classsrc/win/wddraw.h:[61]: error: syntax error before "surf"src/win/wddraw.h:[69]: error: syntax error before "surf"src/win/wddraw.h:[86]: error: syntax error before "surf"src/win/wddraw.h:[92]: error: syntax error before "LPDIRECTDRAWSURFACE2"src/win/wddraw.h:[92]: warning: no semicolon at end of struct or unionsrc/win/wddraw.h:[97]: error: syntax error before '}' tokensrc/win/wddraw.h:[97]: warning: type defaults to `int' in declaration of `BMP_EXTRA_INFO'src/win/wddraw.h:[97]: warning: data definition has no type or storage classsrc/win/wddraw.h:[124]: error: syntax error before "gfx_directx_create_surface"src/win/wddraw.h:[124]: error: syntax error before "LPDDPIXELFORMAT"src/win/wddraw.h:[124]: warning: type defaults to `int' in declaration of `gfx_directx_create_surface'src/win/wddraw.h:[124]: warning: data definition has no type or storage classsrc/win/wddraw.h:[125]: error: syntax error before "surf"src/win/wddraw.h:[130]: error: syntax error before '*' tokensrc/win/wddraw.h:[130]: warning: type defaults to `int' in declaration of `directx_bmp_list'src/win/wddraw.h:[130]: warning: data definition has no type or storage classsrc/win/wddaccel.c: In function `ddraw_blit_to_self':src/win/wddaccel.c:[65]: warning: implicit declaration of function `IDirectDrawSurface2_BltFast'src/win/wddaccel.c:[65]: error: syntax error before ')' tokensrc/win/wddaccel.c:[66]: error: syntax error before ')' tokensrc/win/wddaccel.c:[67]: error: `DDBLTFAST_WAIT' undeclared (first use in this function)src/win/wddaccel.c:[67]: error: (Each undeclared identifier is reported only oncesrc/win/wddaccel.c:[67]: error: for each function it appears in.)src/win/wddaccel.c: In function `ddraw_masked_blit':src/win/wddaccel.c:[100]: error: `DDCOLORKEY' undeclared (first use in this function)src/win/wddaccel.c:[100]: error: syntax error before "src_key"src/win/wddaccel.c: At top level:src/win/wddaccel.c:[109]: error: syntax error before "if"src/win/wddaccel.c:[116]: warning: type defaults to `int' in declaration of `source_parent'src/win/wddaccel.c:[116]: error: conflicting types for 'source_parent'src/win/wddaccel.c:[107]: error: previous declaration of 'source_parent' was heresrc/win/wddaccel.c:[116]: error: `source' undeclared here (not in a function)src/win/wddaccel.c:[116]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[117]: error: syntax error before "while"src/win/wddaccel.c:[120]: error: syntax error before '&' tokensrc/win/wddaccel.c:[120]: warning: type defaults to `int' in declaration of `EnterCriticalSection'src/win/wddaccel.c:[120]: error: conflicting types for 'EnterCriticalSection'C:/Dev-Cpp/bin/../lib/gcc/mingw32/[3].[4].[2]/../../../../include/winbase.h:[1241]: error: previous declaration of 'EnterCriticalSection' was heresrc/win/wddaccel.c:[120]: error: conflicting types for 'EnterCriticalSection'C:/Dev-Cpp/bin/../lib/gcc/mingw32/[3].[4].[2]/../../../../include/winbase.h:[1241]: error: previous declaration of 'EnterCriticalSection' was heresrc/win/wddaccel.c:[120]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[120]: error: syntax error before '++' tokensrc/win/wddaccel.c:[121]: warning: type defaults to `int' in declaration of `gfx_directx_release_lock'src/win/wddaccel.c:[121]: warning: parameter names (without types) in function declarationsrc/win/wddaccel.c:[121]: error: conflicting types for 'gfx_directx_release_lock'src/win/wddraw.h:[108]: error: previous declaration of 'gfx_directx_release_lock'was heresrc/win/wddaccel.c:[121]: error: conflicting types for 'gfx_directx_release_lock'src/win/wddraw.h:[108]: error: previous declaration of 'gfx_directx_release_lock'was heresrc/win/wddaccel.c:[121]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[122]: warning: type defaults to `int' in declaration of `gfx_directx_release_lock'src/win/wddaccel.c:[122]: warning: parameter names (without types) in function declarationsrc/win/wddaccel.c:[122]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[124]: error: syntax error before '(' tokensrc/win/wddaccel.c:[124]: error: syntax error before '->' tokensrc/win/wddaccel.c:[127]: warning: type defaults to `int' in declaration of `hr'src/win/wddaccel.c:[127]: error: conflicting types for 'hr'src/win/wddaccel.c:[105]: error: previous declaration of 'hr' was heresrc/win/wddaccel.c:[127]: warning: implicit declaration of function `IDirectDrawSurface2_Blt'src/win/wddaccel.c:[127]: error: syntax error before ')' tokensrc/win/wddaccel.c:[127]: error: `dest_rect' undeclared here (not in a function)src/win/wddaccel.c:[128]: error: syntax error before ')' tokensrc/win/wddaccel.c:[128]: error: invalid type argument of `->'src/win/wddaccel.c:[128]: error: `source_rect' undeclared here (not in a function)src/win/wddaccel.c:[129]: error: `DDBLT_KEYSRC' undeclared here (not in a function)src/win/wddaccel.c:[129]: error: `DDBLT_WAIT' undeclared here (not in a function)src/win/wddaccel.c:[129]: error: initializer element is not constantsrc/win/wddaccel.c:[129]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[130]: error: syntax error before '&' tokensrc/win/wddaccel.c:[130]: warning: type defaults to `int' in declaration of `LeaveCriticalSection'src/win/wddaccel.c:[130]: error: conflicting types for 'LeaveCriticalSection'C:/Dev-Cpp/bin/../lib/gcc/mingw32/[3].[4].[2]/../../../../include/winbase.h:[1635]: error: previous declaration of 'LeaveCriticalSection' was heresrc/win/wddaccel.c:[130]: error: conflicting types for 'LeaveCriticalSection'C:/Dev-Cpp/bin/../lib/gcc/mingw32/[3].[4].[2]/../../../../include/winbase.h:[1635]: error: previous declaration of 'LeaveCriticalSection' was heresrc/win/wddaccel.c:[130]: warning: data definition has no type or storage classsrc/win/wddaccel.c:[130]: error: syntax error before '--' tokensrc/win/wddaccel.c: In function `ddraw_clear_to_color':src/win/wddaccel.c:[208]: error: `DDBLTFX' undeclared (first use in this function)src/win/wddaccel.c:[208]: error: syntax error before "blt_fx"src/win/wddaccel.c:[217]: error: `blt_fx' undeclared (first use in this function)src/win/wddaccel.c:[224]: error: syntax error before ')' tokensrc/win/wddaccel.c:[226]: error: `DDBLT_COLORFILL' undeclared (first use in this function)src/win/wddaccel.c: In function `ddraw_rectfill':src/win/wddaccel.c:[246]: error: `DDBLTFX' undeclared (first use in this function)src/win/wddaccel.c:[246]: error: syntax error before "blt_fx"src/win/wddaccel.c:[297]: error: `blt_fx' undeclared (first use in this function)src/win/wddaccel.c:[304]: error: syntax error before ')' tokensrc/win/wddaccel.c:[306]: error: `DDBLT_COLORFILL' undeclared (first use in this function)src/win/wddaccel.c: In function `ddraw_hline':src/win/wddaccel.c:[326]: error: `DDBLTFX' undeclared (first use in this function)src/win/wddaccel.c:[326]: error: syntax error before "blt_fx"src/win/wddaccel.c:[365]: error: `blt_fx' undeclared (first use in this function)src/win/wddaccel.c:[372]: error: syntax error before ')' tokensrc/win/wddaccel.c:[374]: error: `DDBLT_COLORFILL' undeclared (first use in this function)src/win/wddaccel.c: In function `ddraw_vline':src/win/wddaccel.c:[393]: error: `DDBLTFX' undeclared (first use in this function)src/win/wddaccel.c:[393]: error: syntax error before "blt_fx"src/win/wddaccel.c:[432]: error: `blt_fx' undeclared (first use in this function)src/win/wddaccel.c:[439]: error: syntax error before ')' tokensrc/win/wddaccel.c:[441]: error: `DDBLT_COLORFILL' undeclared (first use in this function)src/win/wddaccel.c: In function `enable_acceleration':src/win/wddaccel.c:[467]: error: request for member `dwCaps' in something not a structure or unionsrc/win/wddaccel.c:[467]: error: `DDCAPS_BLT' undeclared (first use in this function)src/win/wddaccel.c:[478]: error: request for member `dwCaps' in something not a structure or unionsrc/win/wddaccel.c:[478]: error: `DDCAPS_BLTCOLORFILL' undeclared (first use in this function)src/win/wddaccel.c:[488]: error: request for member `dwCaps' in something not a structure or unionsrc/win/wddaccel.c:[488]: error: `DDCAPS_COLORKEY' undeclared (first use in this function)src/win/wddaccel.c:[489]: error: request for member `dwCKeyCaps' in something nota structure or unionsrc/win/wddaccel.c:[489]: error: `DDCKEYCAPS_SRCBLT' undeclared (first use in this function)src/win/wddaccel.c: In function `enable_triple_buffering':src/win/wddaccel.c:[509]: warning: implicit declaration of function `IDirectDrawSurface2_GetFlipStatus'src/win/wddaccel.c:[509]: error: syntax error before ')' tokensrc/win/wddaccel.c:[509]: error: `DDGFS_ISFLIPDONE' undeclared (first use in thisfunction)src/win/wddaccel.c:[510]: error: `DD_OK' undeclared (first use in this function)src/win/wddaccel.c:[510]: error: `DDERR_WASSTILLDRAWING' undeclared (first use inthis function)make: *** [obj/mingw32/alleg/wddaccel.o] Error [1]
Any thoughts? :(?
If you're really bent on installing Allegro manually, then I probably am of little help to you, but Dev-C++ has a nice little feature for getting packages and installing them for use in Dev-C++.

To get to these packages, in Dev-C++ go to the Tools menu and click Check for updates/Packages. Select a devpak server from the drop down menu and click Check for updates. You'll see a list of packages that you can download, find Allegro and check it and download it. If you don't already have any of the dependencies it should prompt you for what you need. Good luck.
The reason you got the errors was because you may have the DX9.0 SDK, but the compiler doesn't know where to find it. However, even were it able to, there are features that Allegro requires to compile that have been removed from later versions of the DX SDK, so you do need to download either dx70_mgw.zip or dx80_mgw.zip and unzip it to your compiler root directory.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++
How I finally got Allegro working with Dev-C++ under Windows XP:

Most of this knowledge was gained through various web posts and installation documents, the rest was gained through trial and error . Use this information at your own risk. I will occasionally refer you to outside documents. The main reason for my many failed attempts to get Allegro working with Dev-Cpp was the lack of updated install documents (At least I couldn't find them.) explaining that DirectX files were needed, where to find them, and mostly, how to install them. That's why I'm typing this. I hope this helps some people avoid a difficult installation. The Dev-Cpp, Allegro, and DirectX files that are linked to below are all the programs you'll need to get started with the installation. These are the programs I used at the time of typing this document (3-06-06):

http://bloodshed.net/dev/devcpp.html
Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2

http://alleg.sourceforge.net/wip.html#stable
Under the “Stable branch 4.2.0 source releases” heading, download the all420.zip file. Source code for all platforms in DOS/Windows friendly format. On this same web page, under the “miscellaneous files” heading, download the dx80_mgw.zip file. This file contains the minimal version of the DirectX 8 SDK for MinGW. Only for windows.

1. When installing Dev-Cpp don't use “Dev-C++” as its filename this will cause problems for the programs we're trying to install, use “Dev-Cpp” instead. During the Dev-Cpp installation process you want to select the option to “Remove all previous configuration files” so you'll start with a clean slate as much as possible. I Installed Dev-Cpp to its default directory C:\Dev-Cpp. Don't bother to run Dev-Cpp after you install it.

2. Next we'll put the Allegro file in its proper place. If its in zipped format extract it into a folder of your choosing. Find the “allegro” file contained within, then copy or cut and paste it into the C:\Dev-Cpp folder.

3. Next we'll put the DirectX files in their proper place. If they're in zipped format extract them into a folder of your choosing. Find the “include” and “lib” files contained within, then copy or cut and paste them into the C:\Dev-Cpp folder. It will warn you that these files already exist in this folder. Click on “yes to all”. That's all there is to that.

4. Next we need to set the environment variables. I'm working with Windows XP and that's what I'll be describing. If you need information on how to set these environment variables for another OS, see the following document. http://www.allegro.cc/files/install-devcpp.html. To set the environment variables we need to get to the “System Properties”. The keyboard shortcut for this is the “windows logo + (pause break)” keys. GOTO step 6.

5. If you need an alternative method to get to the “System Properties” you can go through “My Computer”, then click on “Control Panel”. Now you need to have the control panel displayed using the classic view. If you see in the upper left corner “Switch to Classic View” click that. If you see “Switch to Category View” you're already in the correct display mode. Now find the “System” icon and click it.

6. Once you have the “System properties” window up click on the “advanced” tab then the “environment variables” button. Under the “System Variables” heading scroll down until you see a line that begins with the word “Path”. Double click this line and an edit window opens allowing you to edit the “Path” system variable. We want to add a new value to the end of this line. Start by positioning your cursor at the end of this line and enter the following: “ ;C:\Dev-Cpp\bin “ without the quotes. Don't forget the semicolon ( ; ), it tells the system that this is the start of a new variable value. Click on the OK button. Next we want to add a new system variable. Under the “System variables” heading click on the “New” button. For the “Variable name” enter “MINGDIR”. For the “Variable value” enter “C:\Dev-Cpp”, then keep clicking the OK buttons until all the windows are closed. Next reboot the computer so the changed environment settings will take effect.

7. Now we're to the critical steps of compiling and installing Allegro to work with Dev-Cpp. If everything was done correctly up to this point it shouldn't be a problem. The first step is opening a command prompt window. Click on Start, then Run. Type cmd and hit enter. The nice thing about the command prompt in Windows XP is that you can copy and paste its contents to a document making it easy to get help for a problem you may be having. All you have to do is right click on the title bar and it gives you some editing options. It's also easily customizable. By right clicking on the title bar and accessing the properties menu, it will display the customizing options.

8.At the command prompt we need to change our current working directory as follows. Type “ cd c:\dev-cpp\allegro “ without the quotes, and hit enter. This should now be the current working directory displayed in the prompt. We need to be in this directory because the files we want access to are in there. The fix.bat file is in this directory and it's the next file we'll be using. Type the following command “fix mingw32” and hit enter, you should see a "Done!" message. Enter the next command “make”, you will see Allegro being compiled. Enter the next command “make install”, Allegro is now being installed. If you seen any error messages something isn't right and you'll have to review what you've done so far. Otherwise it's time to test the installation to see if we can get a simple program to run. Close the command prompt by entering the command “exit”.

9. Run the Dev-C++ program and configure it using its default options if you're not sure what you want. Now we'll create a project to test our Allegro installation. Click on file\ new\ project. Click “windows application”. Under the “project options” heading select “c project” and click OK. Save the project file in any folder and any name you want. After you do that A code editing window should come up with some default code already in it. Using the editing options “select all” of this code and hit the delete key to get rid of it. Now enter in the following code.

#include "allegro.h"
int main()
{
allegro_init();
allegro_message("Hello World!");
return 0;
}
END_OF_MAIN();

10.Next we need to include the Allegro libraries for this code. Click project\ project options, then click the “parameters” tab. Now click the “Add Library or Object” button. In the Open window use the “Look in” portion to navigate your way to the C:\Dev-Cpp\lib folder and select the “liballeg.a” file and click OK. Next hit the F9 key to compile and run this bit of code. A save dialog window will come up. Again save the file in any folder and any name you want. If you see a message window that says “ Hello World! ” Click OK on this window to close it. You're ready to rock and roll.

After everything checks out OK, I would suggest using the Dev-Cpp WebUpdate feature to update any installed components that have a newer version available. Go to “tools” then “check for updates/packages”. When the WebUpdate window opens under the “select devpack server” heading you'll need to select devpacks.org. Then click on the “check for updates” button. When the list is finished building it will show the versions of the components that you have installed and the version of any update that is available. You can select an update that you want by clicking the box next to it. This selects it for downloading. Next click on the “download selected” button. You will be prompted to install these files when they're done downloading.

A few closing notes. I'm a noob at all of this and can't answer any technical questions or any other questions beyond what I've already described here. So if you still don't get it to work after reading this there is nothing I can do for you. Sorry! All I could say is, I know how you feel. It took me a week to get this to work. I could also say that I've seen a lot of people trying to help noobs get started on the forums, so don't give up, ask for help.
Installing allegro on dev-cpp is very easy. Run this file and follow prompts:
Download Allegro

This topic is closed to new replies.

Advertisement