Allegro5 in XCode4 w/ OS X 10.6.xx

kk before i tell you my problem let me make it clear that that I have tried all these links before i made this topic.

BUT there is some wierd problem in my Allegro and I would appreciate it if the people here could help me fix it.

Problem: My XCode doesnt know where the header file is! if i say:
#include<allegro.h> - WONT WORK
#include<allegro5/allegro.h> - WONT WORK
#include<Allegro-5.0/allegro5/allegro.h> - WORKS
but then the #include<allegro5/base.h> in allegro.h gives me a "not found" error

What have done so far??
-i installed allegro the usual way with:
cd allegro
mkdir build
cd build
make install
(no errors)

-then i made a console project in XCode in c++. Added the frameworks (Link with Binary libraries)

-then I CHANGED my header search path according to the wiki above to:
/Library/Frameworks/Allegro-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroAcodec-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroAudio-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroColor-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroDialog-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroFont-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroImage-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroMemfile-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroPhysfs-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroPrimitives-5.0.framework/Versions/Current/Headers /Library/Frameworks/AllegroTTF-5.0.framework/Versions/Current/Headers

-then i clicked compile and pulled my hair for 1 hour before coming here.

Here is what my code looks like:

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

for ur referance and quick analyzation of my problem here is what my screen looks like when i click on compile :)

I hope all the data helps, I just wanna get done with this and start some actual coding.


Are you sure you used -DWANT_FRAMEWORKS=1 and "make" and "make install" both succeeded? Check if you have a folder /Library/Frameworks/Allegro-5.0.framework after running "make install" and that it actually has some headers and libraries inside.

I just tried it here with XCode 4 and it all still works, it's basically the same as XCode 3, just the GetInfo menu is gone and you have those tabs instead. I noted down my steps here:,_Xcode_4,_Framework


I know nothing about Xcode, but I had a similar problem when trying to get Allegro to work in Code::blocks on Ubuntu.

Here is what some one suggested in this thread:
I am not sure hwo to link to the specific comments.. . but here is what worked for me (look for some similar options in your IDE):

You need to add a compiler search directory to your project. Use Menu->Project->BuildOptions, select your main project (not the specific build type) and go to Search Directories->Compiler and add in the directory where you have your allegro headers.


kk, i am gonna make a clean install again and gonna try it out.
between when i posted the question and now, i have gone into pretty deep waters doing all sort of BS and tweaking, trying to make it work :o, (with no luck)

one thing i have realized is the install wont give me dynamic library (.dylib) files.
i thought it might be due to write restrictions so i used ccmake to change the destination. but nope i am missing liballegro.dylib and company (dont remember their whole names).

my conclusion,
-its writting somewhere i am not aware of
-i am missing something (which is usually the case, since computers dont lie)

i will get back to you guys as soon as i follow ur links and comments. peace.


If you follow the wiki guide, then yes, you don't get any .dylib files. Instead you get .framework files (directories actually). They will all be contained within your .app bundle later.

If you're trying the new wiki instruction, just post here as soon as you hit an error and I'll try and figure out what's different to my install.


Kk Elias i followed the wiki guide and i still have the same problem. I followed the wiki (well written) i had the clean install in 2 minutes and a project in 5 :P but thats wehre it stopped.

I tried to to what sec_goat asked me to try and i almost finished it until his last point, XCode has so many paths we can feed it, i dont know which one, for now i have filled the directory list (framework addresses) from the wiki in both- Header Search and User Header Search.

these pic shows the paths which we can fill in project. I have already, filled in the Target one according to the wiki. Just thought sec_goat's advice made sense, so i tried this too.

and yeah i re-checked, my Library/Frameworks does contain the framework with the header files in it. so thats not a problem either.

I am currently in the east corner of the world and its late, i will go zzz and check back in later. i need sleep to think clearly now :)

[this is my best bet as to what the problem is, i just need to figure it out.]
OK and here one more screen dump for the time when it actually WORKS upto the header files WITH [b]Allegro-5.0[\b] before them
(eg: #include<Allegro-5.0/allegro5/allegro.h => this will call allegro.h which has a call to #include<allegro5/base.h> where it gets stuck)

so basically if only i could ask the Allegro devs to stick a "Allegro-5.0" custom made for me b4 every call.. hehe, later. and thx. i appreciate it. - i got into allegro.h but then i got stuck.
edit: just made this post a bit readable and typos, i am sleepy.


"User Header Search Paths" need not be modified to find the Allegro headers. In your screenshot, you only changed the search path for the Release build - is that what you actually are using?

Can you expand the command causing the error in the build log to check if it passes the right parameters to gcc/clang?


(sorry for the late reply, but i needed a break, i spent a whole day on this yesterday :) )
no i changed the Header search paths for the target cocoa application as well.. i just posted that screen shot to see if thats what sec_goat meant.

i guess this what you mean.
this is the error generated when i include <Allegro-5.0/allegro5/allegro.h>

and this is our error when I include the legit <allegro5/allegro.h>

i hope this is what u needed. if i am reading this right, only the last part matters and i think it is getting the file path right. but hten i dont get why would it not find the headers and fine the headers when i append Allegro-5.0 to the paths.


Ok, so the Header Search Paths is not set somehow (it should show all the -I Library/Frameworks... lines for the Allegro headers). As I said, make sure you have that Debug/Release thing right as it looks weird in your screenshot. Here is how it looks for me:


And this is how the correct options are passed during the build, in your case there aren't any of the Header Search Paths.


Thread #607380. Printed from