Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Does not exist!!!

This thread is locked; no one can reply to it. rss feed Print
Does not exist!!!
Lavargian
Member #8,133
December 2006

Hi, I just downloaded Allegro a few minutes ago, and I am using a jGRASP editor to write my code. I am trying to test it out by creating a program that creates a white background screen, and draws two circles, two rectangles, and two triangles. One of each will be not colored in, and one of each will be filled in with a color. The problem is when I try to compile this program it comes up with an error that says

"allegro.h: No such file or directory"

So, I was wondering if any one could tell me how to install or use allegro with the jGRASP editor?

Thanks for all your responses!!! :D

oh and here is a copy of the program that I wrote. Just in case you need to see it to help me out.

1 
2#include <allegro.h>
3 
4BITMAP *xSprite;
5BITMAP *oSprite;
6 
7int main(){
8
9 allegro_init();
10 install_keyboard();
11 set_color_depth(16);
12 set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
13
14 xSprite = load_bitmap( "x.bmp", NULL);
15
16 oSprite = load_bitmap( "o.bmp", NULL);
17 
18 acquire_screen();
19
20 line( screen, 200, 0, 200, 480, makecol( 255, 255, 255));
21 line( screen, 400, 0, 400, 480, makecol( 255, 255, 255));
22 line( screen, 0, 150, 680, 150, makecol( 255, 255, 255));
23 line( screen, 0, 300, 680, 300, makecol( 255, 255, 255));
24
25 draw_sprite( screen, xSprite, 0, 0);
26 draw_sprite( screen, oSprite, 200, 0);
27 draw_sprite( screen, xSprite, 400, 0);
28
29 draw_sprite( screen, oSprite, 0, 150);
30 draw_sprite( screen, xSprite, 200, 150);
31 draw_sprite( screen, oSprite, 400, 150);
32 
33 draw_sprite( screen, oSprite, 0, 300);
34 draw_sprite( screen, xSprite, 200, 300);
35 draw_sprite( screen, oSprite, 400, 300);
36
37 release_screen();
38 
39 readkey();
40
41 return 0;
42
43}
44END_OF_MAIN();

Rick
Member #3,572
June 2003
avatar

Do you have allegro.h in your include directory to the compiler you are using. Also I usually do "allegro.h" not <allegro.h>, not sure if that does anything or not.

========================================================
Actually I think I'm a tad ugly, but some women disagree, mostly Asians for some reason.

Lavargian
Member #8,133
December 2006

I tried writing

"allegro.h"

and the same error came up, so I guess that doesn't really matter, but Anyway, I think I need to know how to do what you suggested. See I am pretty much a complete noob when it comes to this stuff, and I have learned the basics of C++, and now I want to get into some light game programming. I just need to know how to include the allegro files into my compiler so it knows where to find the allegro files. By the way I am using a

g++ - MinGW (C:\mingw\bin)

compiler, and I am using jGRASP as an editor.
I go from setting < compiler setting < workspace, I am sure I am able to add in the allegro files to my compiler I just don't know how to do it!!! :-/

ixilom
Member #7,167
April 2006
avatar

If you are using the prebuilt allegro binaries, the zip contains 3 folders

  • bin

  • include

  • lib

Copy the "include" and "lib" directories to your c:\mingw directory.
Explorer or whatever filemanager you use might say "include already exists", its okay, it is not going to overwrite anything since its all new files.

After copying those directories, you should have allegro.h in your c:\mingw\include directory.
Also a new directory, c:\mingw\include\allegro.

The bin directory contains the DLL files allegro uses when you compile a dynamic version of your game/program. Personally, I copy these to c:\windows\system32. Someone might object to that because it "clutters" your harddrive ::)
If you don't copy them to c:\windows\system32\ copy them to the project directory like:
c:\documents and settings\ixilom\allegrostuff\mygame\

Now you should be able to do

#include <allegro.h>

___________________________________________
Democracy in Sweden? Not since 2008-Jun-18.
<someone> The lesbians next door bought me a rolex for my birthday.
<someone> I think they misunderstood when I said I wanna watch...

Tobias Dammers
Member #2,604
August 2002
avatar

Quote:

Also I usually do "allegro.h" not <allegro.h>, not sure if that does anything or not.

You use "" quotes for local includes (headers specific to the current project, that are located in the project's folder or one of its subfolders), and <> brackets to include headers from the compiler's include directory - stdlib, stl, and all libraries you have installed.
When installing allegro, you need to run "make install"; if you have configured your compiler environment correctly, this will copy allegro.h to the correct folder. Please take the time to read the allegro installation instructions.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Go to: