|
Compilation error: allegro.h not found |
Wintermond
Member #11,231
August 2009
|
Hello I'm trying to compile my first allegro program. I thought the installation worked (according to the readme-file in allegro-4.9.12.zip i did: cmake, make, make install. all three commands gave no error messages). When doing: The compiler answers: Do I need to add some parameters to the gcc-command (specify where the header file is)? The examples (which came in the allegro zip-file) are compiled - and working. So I guess, it can't be too difficult to compile my own... Thanks for your help! |
LennyLen
Member #5,313
December 2004
|
Try #include <allegro5/allegro.h> or #include <allegro5/allegro5.h>
|
Evert
Member #794
November 2000
|
Are you sure 4.9.12 is what you want? That's the unstable development branch for the next version of Allegro. |
Wintermond
Member #11,231
August 2009
|
Thank you, LennyLen! Unfortunately I've got another problem now. I don't know if that matters, but I'm running Mac OS X 10.5 on a G5. My code: #include <allegro5/allegro.h> int main(int argc, char* argv[]) { al_init(); return 0; } END_OF_MAIN() Compilers opinion (started with: gcc hello.cpp): Undefined symbols: |
Arthur Kalliokoski
Second in Command
February 2005
|
Maybe you should try g++ instead of gcc? They all watch too much MSNBC... they get ideas. |
Wintermond
Member #11,231
August 2009
|
The response of g++ is similar: Undefined symbols: |
Arthur Kalliokoski
Second in Command
February 2005
|
You need to put END_OF_MAIN() after the, well, end of main(). They all watch too much MSNBC... they get ideas. |
Wintermond
Member #11,231
August 2009
|
I did: #include <allegro5/allegro.h> int main(int argc, char* argv[]) { al_init(); return 0; } END_OF_MAIN()
|
Matthew Leverton
Supreme Loser
January 1999
|
You need to link with `pkg-config allegro-4.9 --libs` or the OS X equivalent. |
Evert
Member #794
November 2000
|
Matthew Leverton said: You need to link with `pkg-config allegro-4.9 --libs` or the OS X equivalent. It's that in OS X. |
Arthur Kalliokoski
Second in Command
February 2005
|
tsk I just tried compiling an a5 program myself (allegro-4.9.12/examples/ex_acodec.c) and it took me 15 minutes of poking around to stumble across They all watch too much MSNBC... they get ideas. |
Matthew Leverton
Supreme Loser
January 1999
|
`pkg-config allegro-4.9 kcm_audio-4.9 a5_acodec-4.9 --libs` |
Arthur Kalliokoski
Second in Command
February 2005
|
So if I fiddle around with nm(1) long enough and sort which functions are in which libraries I can add to the docs? They all watch too much MSNBC... they get ideas. |
Evert
Member #794
November 2000
|
Arthur Kalliokoski said: So if I fiddle around with nm(1) long enough and sort which functions are in which libraries I can add to the docs?
The documentation already lists which functions go into which addon (or rather, which addon contains which function) - although that may be a recent addition. It should probably also give you the linker option or the name of the library to link with to get that particular addon. In your particular example, "ex_acodec" should be a hint that you need to link at least with a5_acodec (otherwise a glance at the source should tell you this), which depends on kcm_audio (pkg-config would pull that dependency in automatically, I think). So it shouldn't be that hard to figure out. |
Matthew Leverton
Supreme Loser
January 1999
|
I don't think it does. e.g., the font section has both font addons merged together (as it should). But it's not hard to figure out. Each function should ultimately be marked with header file, library file, and in which Allegro version it first appeared (beginning with 5.0.0). |
Wintermond
Member #11,231
August 2009
|
Thank you all! Just had to download pkg-config. My do-nothing-allegro-program compiles now, using: g++ `pkg-config allegro-4.9 --libs` hello.cpp To Evert (asking if I'm sure, that 4.9.12 is what I want): No actually I was/am not sure. I just downloaded the newest version from Sourceforge and tried to follow the instructions in the readme file. Since I have a working environment now, I think (at least I hope) I will be fine... Thanks again to everyone! |
Peter Wang
Member #23
April 2000
|
pkg-config pulls in dependencies, so you only actually need to list the top one, e.g. `pkg-config --libs a5_acodec-4.9`
|
Evert
Member #794
November 2000
|
Wintermond said: No actually I was/am not sure. I just downloaded the newest version from Sourceforge and tried to follow the instructions in the readme file. Since I have a working environment now, I think (at least I hope) I will be fine...
Ok. In that case, I applaud your determination and encourage you to ask lots of questions and give loads of feedback on the library and the documentation. The reason is that the library (and the API) are not stable yet and still subject to change , so if something is not designed well, it can still be fixed now. |
|