liballeg/allegro_wiki

MacOS compile instructions need updating to show correct args to pkg-config

stephensmith9 opened this issue · 2 comments

Tried to compile on my Mac running 10.13.6 (High Sierra) and got this error:

$ make
c99 `pkg-config --cflags allegro-5 allegro_font-5` -g -Wall -O3 hello.c `pkg-config --libs allegro-5 allegro_font-5` -o hello
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: __al_mangled_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [hello] Error 1

and found this solution (https://stackoverflow.com/q/28846566) on Stack Overflow (the actual solution is in the comments under the original question).

It appears to be a simple matter of adding allegro_main-5 to cflags and libs. This apparently is only needed on MacOS. So perhaps the instructions could be updated to reflect this?

This is the command line that worked for me:

gcc hello.c -o hello $(pkg-config allegro-5 allegro_main-5 allegro_font-5 --libs --cflags)

Oops, of course, I can just edit the wiki myself. Done.

Thanks for fixing it :).