Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code from a tutorial and i am trying to compile it on a mac using g++/gcc however every time it complains about the native dialog but i am referencing the library correctly i think


int main()

    al_show_native_message_box(NULL, NULL, "Error", "Could not initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR); 

display = al_create_display(800, 600); 

    al_show_native_messagebox(NULL, NULL, "Error", "Could not create Allegro 5 display", NULL, ALLEGRO_MESSAGEBOX_ERROR);


return 0;

The error i get is

main.cpp: In function ‘int _al_mangled_main()’:
main.cpp:17: error: ‘al_show_native_messagebox’ was not declared in this scope

And the command i use is

g++ -o main main.cpp -lallegro -lallegro_main -lallegro_native_dialog

I have also tried with

g++ -o main main.cpp -lallegro -lallegro_main -lallegro_dialog

Any help would be great.


share|improve this question

closed as too localized by Arcane Engineer, Maik Semder, Josh Petrie, bummzack, Sean Middleditch Jan 4 '13 at 18:29

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

This question's scope is too localised. This is a bug that is specific to you and won't ever help anyone else who searches this site for answers. Try not to post such issues as questions, in future. Remember that the SE sites serve as knowledgebases for expert knowledge in various fields. I've voted to close. Refer to the FAQ. – Arcane Engineer Jan 2 '13 at 12:09
Couldnt disagree more. It is an issue with compiling, something must have been missed like a library include. How would that not be helpful to someone else if they are in the same situation? – Jonathan Dixon Jan 2 '13 at 12:11
You can disagree as much as you like, but "not being able to get C code to compile due to library include issues" has been addressed countless times on every nook and cranny of the internet ever since it's inception. But even were you right in this sense -- and you are not -- then this question would belong on, not on – Arcane Engineer Jan 2 '13 at 12:14
I've flagged it for removal to stackoverflow, as they will probably be willing to answer it there. In the meantime, try not to double post there. One of the mods will migrate this question later today. Thanks for your understanding. – Arcane Engineer Jan 2 '13 at 12:19
No problem thanks for sorting it out for me – Jonathan Dixon Jan 2 '13 at 12:22
up vote 2 down vote accepted

Without knowing anything about your framwork:

You used al_show_native_messagebox and al_show_native_message_box. al_show_native_message_box was used first and does not result in an error so I guess the second one should be al_show_native_message_box too?

share|improve this answer
Thanks a million – Jonathan Dixon Jan 2 '13 at 16:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.