New Mac, new OS, now my code won't run

First off, I should mention that I’m kind of a coding newbie, so please be patient with me! Up until recently, I’ve been using an eight year old iMac running OS X 10.6, but I just bought a brand new six core Mac Pro with OS X 10.10, and I’ve been trying to get my old SDL 1.2 programs to run.

I installed Xcode 5 on my new computer (I had read a lot of bad reviews about Xcode 6). I tried opening my old Xcode docs and they wouldn’t compile, which I figured might happen, so I went back to the same tutorial video that I used to set up SDL 1.2 on my old computer: http://youtu.be/d3TPsUAO3L4

And I tried to create a test project just to see if I could get the SDL window to open, but it still wouldn’t compile. I got this long list of errors. These are a few of them:

/SDL1-2_SetUp/SDLMain.m:50:12: Cast of C pointer type ‘CFDictionaryRef’ (aka ‘const struct __CFDictionary *’) to Objective-C pointer type ‘const NSDictionary *’ requires a bridged cast
/SDL1-2_SetUp/SDLMain.m:166:16: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:166:16: ARC forbids explicit message send of ‘release’
/SDL1-2_SetUp/SDLMain.m:167:15: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:167:15: ARC forbids explicit message send of ‘release’
/SDL1-2_SetUp/SDLMain.m:182:15: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:182:15: ARC forbids explicit message send of ‘release’

Anyway, I don’t really understand what this all means, but I didn’t get these errors with my SDL projects on my old computer, so I’m wondering if this is because SDL 1.2 is so old it won’t run on a current OS? I spent so much time on these programs and I’d really like to be able to run them again, but I don’t have the knowhow to update the code for SDL 2.0. If anyone has any ideas on how to get SDL 1.2 to run in Xcode 5, I’d be so grateful!

Try setting your deployment target and probably also the target SDK to
an older OS X version. 10.7 might work. (I think the 10.6 SDK isn’t
shipped anymore with recent XCode versions, so 10.7 might be the lowest
one you can set.)

More info:

https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.htmlOn 06/03/15 03:47, Explodey wrote:

[…] I just bought a brand new six core Mac Pro
with OS X 10.10, and I’ve been trying to get my old SDL 1.2 programs to run.
[…]

And I tried to create a test project just to see if I could get the SDL
window to open, but it still wouldn’t compile. I got this long list of
errors.

Objective-C?s Automatic Reference Counting (ARC) is enabled by default for new projects, but the old SDL 1.2 SDLMain.m file does manual reference counting, so you?ll need to disable ARC.
You can do that for the whole project in the Build Settings tab in the project, or for a specific file by adding the -fno-objc-arc compiler flag for the file?s Compiler Flags in the Build Phases tab for the project?s target.

Also, I highly recommend using SDL 2 instead. It fixes a ton of issues with SDL 1.2, has a lot of new useful APIs, and is just better in general. You might need to do a bit of work to update your code for it though: https://wiki.libsdl.org/MigrationGuide> On Mar 5, 2015, at 9:47 PM, Explodey wrote:

And I tried to create a test project just to see if I could get the SDL window to open, but it still wouldn’t compile. I got this long list of errors. These are a few of them:

/SDL1-2_SetUp/SDLMain.m:50:12: Cast of C pointer type ‘CFDictionaryRef’ (aka ‘const struct __CFDictionary *’) to Objective-C pointer type ‘const NSDictionary *’ requires a bridged cast
/SDL1-2_SetUp/SDLMain.m:166:16: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:166:16: ARC forbids explicit message send of ‘release’
/SDL1-2_SetUp/SDLMain.m:167:15: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:167:15: ARC forbids explicit message send of ‘release’
/SDL1-2_SetUp/SDLMain.m:182:15: ‘release’ is unavailable: not available in automatic reference counting mode
/SDL1-2_SetUp/SDLMain.m:182:15: ARC forbids explicit message send of ‘release’

Anyway, I don’t really understand what this all means, but I didn’t get these errors with my SDL projects on my old computer, so I’m wondering if this is because SDL 1.2 is so old it won’t run on a current OS? I spent so much time on these programs and I’d really like to be able to run them again, but I don’t have the knowhow to update the code for SDL 2.0. If anyone has any ideas on how to get SDL 1.2 to run in Xcode 5, I’d be so grateful!


SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hallelujah! Disabling ARC did the trick. Thanks Alex. I still have to set up the mixer and stuff before I can run my old programs, but I got my test code to run, so I’m on the right track.

I was planning on learning SDL 2, but then I took a Java class, and now I think I’m going to focus on learning Android development.

SDL 2 works great on Android! :wink:

Jonny DOn Friday, March 6, 2015, Explodey wrote:

Hallelujah! Disabling ARC did the trick. Thanks Alex. I still have to
set up the mixer and stuff before I can run my old programs, but I got my
test code to run, so I’m on the right track.

I was planning on learning SDL 2, but then I took a Java class, and now I
think I’m going to focus on learning Android development.

Okay, now I’m having another problem that maybe someone can help me with. I set up a simple test program that’s supposed to show an image. I included this:

Code:
if (image == NULL)
{
std::cout << “Can’t find image\n”;
return 1;
}

to see if it’s finding the image file, and it’s not. I keep getting the “Can’t find image” message, and I don’t know why. I dragged the image file into the project navigator in my Xcode project, and when that didn’t work, I put a copy of my image into every folder and subfolder in my project, but still no luck.

Whenever I had this problem on my old computer, I would just put a copy of the document into the build/debug folder in my project, but Xcode 5 doesn’t seem to create any such folder.

Explodey wrote:

Okay, now I’m having another problem that maybe someone can help me with…

Okay, I figured it out. Apparently, this version of Xcode puts the build data in a different place. It also seems to have make all my build folders in my old projects disappear, for reasons I still don’t understand. I had to go back to my old computer and recopy all my old project folders, and then I had to enable legacy target settings in the project settings. Kind of a pain, but at last, I’m finally able to get my old programs to run again! I’m so glad I hadn’t yet gotten rid of my computer, or this would have been a huge disaster!