Programming Discussion

Xcode 4 and SDL Templates

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Xcode 4 and SDL Templates

Postby Armyof1 » Sat Mar 19, 2011 9:22 pm

I was able to get SDL working on Xcode 3.2 quite easily but I just upgraded to Xcode 4 (which I like much more) but am having trouble using the Xcode template and even just getting the SDL framework to work in general.

I'm sorry is this is a retarded question, I was just wondering if anyone else has had issues with this...
User avatar
Armyof1
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 11
Joined: Sun Sep 05, 2010 1:03 am
Location: Nebraska

Re: Xcode 4 and SDL Templates

Postby Falco Girgis » Sun Mar 20, 2011 2:32 am

Fuck the templates. I actually had a bunch of trouble with the templates in 3.*, since my own projects required a custom setup.

1) Start a new COCOA project.
2) Steal the Objective-C main and add to your project
3) Add the Framework/Dylib to your project
4) Add the header files

Done. That's literally all the template did.
Endlessly in faithful pursuit of The Policy of Pristinity.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
 
Posts: 10188
Joined: Thu May 20, 2004 3:04 pm
Location: Studio Vorbis, AL

Re: Xcode 4 and SDL Templates

Postby starpause » Thu Jul 14, 2011 5:44 pm

:worship: GyroVorbis

After trying a few other things (like loading an old Xcode3 template in that IDE, saving the project and trying to build in Xcode4) I think you've got the right idea. However, I'm too new to know what to do at each step you describe. Here's how I've broken it down so far ...

0) install SDL framework
a) download runtime libraries from http://www.libsdl.org/download-1.2.php
b) install by reading the readme files on the DMG

1) Start a new COCOA project.
a) File -> New -> New Project
b) iOS -> Application -> Window-based Application
c) Product Name: FuckTheTemplate, Device Family: iPad, Next

2) Steal the Objective-C main and add to your project
-) where am i stealing from? what file exactly? i guessed and grabbed SDLMain.m and SDLMain.h from a template.

3) Add the Framework/Dylib to your project
a) highlight SpoutNoTemplate in the Project Navigator (left hand pane of Xcode4) -> Build Phases -> Link Binary With Libraries -> + Button -> find or browse for SDL.framework -> OK
b) optional: drag SDL.framework into the Frameworks folder in Project Navigator

4) Add the header files
-) same question as step two, where are these from and how do i do it?

Thanks so much for your help on this! I see no point in templates ... teach a man to fish!
starpause
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Thu Jul 14, 2011 5:28 pm

Re: Xcode 4 and SDL Templates

Postby avansc » Thu Jul 14, 2011 6:57 pm

programmers are note suppose to fish, we are lazy, we dont reinvent the wheel... use the template. if its broken fix it, but reuse as much as you can. If you need a special setup like falco, then alter it.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
avansc
Respected Programmer
Respected Programmer
 
Posts: 1722
Joined: Sun Nov 02, 2008 8:29 pm

Re: Xcode 4 and SDL Templates

Postby Falco Girgis » Thu Jul 14, 2011 7:05 pm

The setup that I just described is exactly what the template is... except that it actually worked.

starpause wrote:-) where am i stealing from? what file exactly? i guessed and grabbed SDLMain.m and SDLMain.h from a template.
Yeah, that's right.

starpause wrote:-) same question as step two, where are these from and how do i do it?
Every library is distributed as some form of a binary with header files. These are what you downloaded from the SDL website. SDL.h is one of the files.

In the same project properties dialog as when you added the framework, there should be an option for adding additional include paths. Just specify the folder that your SDL headers are in.
Endlessly in faithful pursuit of The Policy of Pristinity.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
 
Posts: 10188
Joined: Thu May 20, 2004 3:04 pm
Location: Studio Vorbis, AL

Re: Xcode 4 and SDL Templates

Postby avansc » Thu Jul 14, 2011 7:09 pm

I just tried the templates with Xcode4 for shits and giggles, and yeah they are broken, but you only have to change like 2 things. I never liked how SDL works in OSX.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
avansc
Respected Programmer
Respected Programmer
 
Posts: 1722
Joined: Sun Nov 02, 2008 8:29 pm

Re: Xcode 4 and SDL Templates

Postby starpause » Thu Jul 14, 2011 7:50 pm

Guys, thanks for the fast response!

avansc wrote:I just tried the templates with Xcode4 for shits and giggles, and yeah they are broken, but you only have to change like 2 things.


Could you point the things out or share your fixed templates? It's not obvious to me what needs to be changed but I'm glad you were able to iron out the issues.

I'm aware of the minimal template borealkiss made but when I load it up I don't see any references to SDL in the application (no SDL.framework included etc). Am I missing something obvious?

My issue with templates isn't with when they just work, but when they are broken it's more effort to fix them. If there was a clear step-by-step for doing a project then it's easier to identify which steps are broken. Hard to say which method boils down to less work in the big picture.

Back to FTT w/ GyroVorbis, I copied the Headers folder from the SDL runtime DMG into my project and linked to the SDL.h file, that got rid of many errors. I then changed #import <Cocoa/Cocoa.h> in SDLMain.h to <Foundation/Foundation.h> (based on http://stackoverflow.com/questions/7455 ... oa-cocoa-h). Down to 12 issues in just the SDLMain.m file ... first one is SDLMain.m:17: error: cannot find interface declaration for 'NSApplication'

Is this because I copied the SDLMain.m file for a desktop application into an iPhone project? Ideas on work arounds?
starpause
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Thu Jul 14, 2011 5:28 pm

Re: Xcode 4 and SDL Templates

Postby avansc » Thu Jul 14, 2011 8:47 pm

starpause wrote:Guys, thanks for the fast response!

avansc wrote:I just tried the templates with Xcode4 for shits and giggles, and yeah they are broken, but you only have to change like 2 things.


Could you point the things out or share your fixed templates? It's not obvious to me what needs to be changed but I'm glad you were able to iron out the issues.

I'm aware of the minimal template borealkiss made but when I load it up I don't see any references to SDL in the application (no SDL.framework included etc). Am I missing something obvious?

My issue with templates isn't with when they just work, but when they are broken it's more effort to fix them. If there was a clear step-by-step for doing a project then it's easier to identify which steps are broken. Hard to say which method boils down to less work in the big picture.

Back to FTT w/ GyroVorbis, I copied the Headers folder from the SDL runtime DMG into my project and linked to the SDL.h file, that got rid of many errors. I then changed #import <Cocoa/Cocoa.h> in SDLMain.h to <Foundation/Foundation.h> (based on http://stackoverflow.com/questions/7455 ... oa-cocoa-h). Down to 12 issues in just the SDLMain.m file ... first one is SDLMain.m:17: error: cannot find interface declaration for 'NSApplication'

Is this because I copied the SDLMain.m file for a desktop application into an iPhone project? Ideas on work arounds?


here this is not a template, but should get you up and running. there is really nonthing fancy about it, just read the xcode documentation on the apple developer site.

just note that this project is setup to look for SDL.framework in /Library/Frameworks, but you can change it to look where ever you want.

http://s000.tinyupload.com/index.php?file_id=45035656141833084206&gk=laptop
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
avansc
Respected Programmer
Respected Programmer
 
Posts: 1722
Joined: Sun Nov 02, 2008 8:29 pm

Re: Xcode 4 and SDL Templates

Postby Falco Girgis » Thu Jul 14, 2011 9:16 pm

OH SHIT! I just realized this is an iOS project! Is SDL even supported on iOS? I have no idea in that case...

I'm fairly certain that .dmg that you downloaded is just for OSX?
Endlessly in faithful pursuit of The Policy of Pristinity.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
 
Posts: 10188
Joined: Thu May 20, 2004 3:04 pm
Location: Studio Vorbis, AL

Re: Xcode 4 and SDL Templates

Postby avansc » Thu Jul 14, 2011 10:58 pm

I'll make a genuine xcode4 SDL template for you tomorrow.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
avansc
Respected Programmer
Respected Programmer
 
Posts: 1722
Joined: Sun Nov 02, 2008 8:29 pm

Re: Xcode 4 and SDL Templates

Postby starpause » Sat Jul 16, 2011 2:30 pm

@avansc ... your example project has me off the ground, thanks much :cheers:

@GyroVorbis people have developed iOS apps with SDL, yes. 1.3 comes with some example projects for iPhone. between those and avansc's example project i feel i'm close.
starpause
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Thu Jul 14, 2011 5:28 pm


Return to Programming Discussion

  • View new posts
  • View unanswered posts
  • Who is online
  • In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
  • Most users ever online was 91 on Fri Oct 26, 2012 8:51 am
  • Users browsing this forum: No registered users and 2 guests