Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro5 in XCode4 w/ OS X 10.6.xx

This thread is locked; no one can reply to it. rss feed Print
Allegro5 in XCode4 w/ OS X 10.6.xx
dtx_code_mode
Member #12,878
May 2011

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.
http://www.allegro.cc/forums/thread/603300
http://www.allegro.cc/forums/thread/603237/852823#target
http://www.allegro.cc/forums/thread/606960
http://www.allegro.cc/forums/thread/606855
and
http://wiki.allegro.cc/index.php?title=OSX,_Xcode_3,_Framework

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
cmake -DWANT_FRAMEWORKS=1
make
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:

#SelectExpand
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 :)
http://cl.ly/3G16270j3O1W1L391f3Y
http://cl.ly/232t3I3p2Y3v1Z3e3e1X

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

Elias
Member #358
May 2000

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: http://wiki.allegro.cc/index.php?title=OSX,_Xcode_4,_Framework

--
"Either help out or stop whining" - Evert

sec_goat
Member #12,838
May 2011

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: http://www.allegro.cc/forums/thread/607359
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.

dtx_code_mode
Member #12,878
May 2011

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
or
-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.

Elias
Member #358
May 2000

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.

--
"Either help out or stop whining" - Evert

dtx_code_mode
Member #12,878
May 2011

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.

(I)
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.
http://cl.ly/013M0n2g3P3w410v3F3t

(II)
and yeah i re-checked, my Library/Frameworks does contain the framework with the header files in it. so thats not a problem either.
http://www.cl.ly/3I2q2x1c3c2E2M0q1N2o

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 :)

(III)
[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.
http://cl.ly/092Q38423M091w362I36 - i got into allegro.h but then i got stuck.
edit: just made this post a bit readable and typos, i am sleepy.

Elias
Member #358
May 2000

"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?

--
"Either help out or stop whining" - Evert

dtx_code_mode
Member #12,878
May 2011

(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>
http://cl.ly/453J2V2m3H3G031H3a2w

and this is our error when I include the legit <allegro5/allegro.h>
http://cl.ly/2s072p1z180R09111W1G

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.

Elias
Member #358
May 2000

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:

{"name":"Screen%20shot%202011-05-21%20at%205.15.25%20PM.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/3\/139f72e0ead88872e5fbe7f73f247fce.png","w":1280,"h":978,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/3\/139f72e0ead88872e5fbe7f73f247fce"}Screen%20shot%202011-05-21%20at%205.15.25%20PM.png

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

{"name":"Screen%20shot%202011-05-21%20at%205.15.00%20PM.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/ee48c59025b0d4c63145648aa97a9977.png","w":1280,"h":978,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/ee48c59025b0d4c63145648aa97a9977"}Screen%20shot%202011-05-21%20at%205.15.00%20PM.png

--
"Either help out or stop whining" - Evert

Go to: