0
\$\begingroup\$

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

#include<allegro5/allegro.h> 
#include<allegro5/allegro_native_dialog.h> 

int main()
{
ALLEGRO_DISPLAY *display; 

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

display = al_create_display(800, 600); 

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

al_destroy_display(display);

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.

Thanks

\$\endgroup\$
5
  • \$\begingroup\$ 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. \$\endgroup\$
    – Engineer
    Jan 2, 2013 at 12:09
  • \$\begingroup\$ 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? \$\endgroup\$ Jan 2, 2013 at 12:11
  • \$\begingroup\$ 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 stackoverflow.com, not on gamedev.se. \$\endgroup\$
    – Engineer
    Jan 2, 2013 at 12:14
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – Engineer
    Jan 2, 2013 at 12:19
  • \$\begingroup\$ Just search for that function in the headers and include that header \$\endgroup\$ Jan 2, 2013 at 12:45

1 Answer 1

2
\$\begingroup\$

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?

\$\endgroup\$
0

Not the answer you're looking for? Browse other questions tagged .