Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » How to link allegro to GNUCC mac?

This thread is locked; no one can reply to it. rss feed Print
How to link allegro to GNUCC mac?
DrZoidberg5
Member #15,446
January 2014

Hi! I tried to use allegro on mac with the GNU CC compiler, in the terminal. I followed the steps on the README_make.txt file, but it doesn't work. ¿What should i do?

PS.: Forgive my bad english.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

DrZoidberg5
Member #15,446
January 2014

Yeah, sorry, now I tried it a second time a it seemed like it worked.
However, i tried an example with the following code:

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

I tried to compile it but i got this error:

gcc mygame.c -o mygame $(pkg-config --libs allegro-5 allegro_image-5)
Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
     (maybe you meant: __al_mangled_main)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

DrZoidberg5
Member #15,446
January 2014

Well, that worked, I should claim my stupidity price xD.

Go to: