error compile allegro5 on linux

Write your question here.

So when i compile the regular display example for allegro 5 using this command on my Linux terminal:

g++ main.cpp -o run.o -I/usr/include/allegro5 -L/usr/lib -lallegro

this is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <allegro5/allegro.h>
 
int main(int argc, char **argv){
 
   ALLEGRO_DISPLAY *display = NULL;
 
   if(!al_init()) {
      fprintf(stderr, "failed to initialize allegro!\n");
      return -1;
   }
 
   display = al_create_display(640, 480);
   if(!display) {
      fprintf(stderr, "failed to create display!\n");
      return -1;
   }
 
   al_clear_to_color(al_map_rgb(0,0,0));
 
   al_flip_display();
 
   al_rest(10.0);
 
   al_destroy_display(display);
 
   return 0;
}


and i get this error:

1
2
3
4
5
6
7
8
9
10
11
12
13

In file included from /usr/local/include/allegro5/allegro.h:53:0, from 

main.cpp:1: /usr/local/include/allegro5/render_state.h:14:25: error: 

conflicting declaration ‘ALLEGRO_ALPHA_TEST’ In file included from /usr/local

/include/allegro5/allegro.h:29:0, from main.cpp:1: /usr/local/include/allegro5

/bitmap.h:23:4: error: ‘ALLEGRO_ALPHA_TEST’ has a previous declaration as ‘ 

ALLEGRO_ALPHA_TEST’


can anyone help me out here?
Last edited on
> the regular display example for allegro 5
I've got no idea what are you referring to.
Post the code, or a link.
Ive just added the code ne555
It works fine with allegro 5.0.10-1 and gcc 4.8.2 or clang 3.4

-I/usr/include/allegro5

that's incorrect. you are using #include <allegro5/allegro.h> so the include path should be simply
-I/usr/include


because of that, the compiler is using /usr/local/include/allegro5/allegro.h
maybe you've got an outdated version there, as I don't have a `render_state.h' file
nope i just get the same error
¿the exact same error message?
¿is /usr/local/include a symbolic link to /usr/include? (or vice versa)


¿what version are you using?
I think i might be using allegro 4
You know its possible that my installation of allegro 5 is conflicting with allegro 4
Great! i fixed it thanks for your help!

i used this command:

g++ -W -Wall -s -O2 -pipe test1.cpp -o test1.exe `allegro-config --libs`
Topic archived. No new replies allowed.