🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

XCode error with SDL OpenGL template.

Started by
2 comments, last by szymczyk 16 years, 9 months ago
(back ground info) So I'm working on a project and I realized it doesn't compile with out ZeroLink, at first I thought it was the code, then I thought it was the project so I was going to compare it to the template projects when I realized that they get the same type of error. (error) warning [path to OpenGL framework] cputype(18, architecture ppc) does nto match cputype (7) for specified -arch flag: i386 (file not loaded) Undefined symbols: -glClear -glClearColor [everything related to OpenGL]
Advertisement
You're getting errors because the linker can't find the OpenGL framework. This is an unusual problem because the OpenGL framework is one of Apple's frameworks, and Apple's frameworks normally work well with Xcode right out of the box.

The first thing you should do is turn off ZeroLink and try to build the debug version of your program. If you're running a recent version of Xcode, choose Build > Allow ZeroLink to turn it off.

If turning off ZeroLink doesn't solve the problem, make sure you're linking the OpenGL framework. In the Groups and Files list, there should be a disclosure triangle next to Targets. Click it to see your project's target. Click the target's disclosure triangle to see its build phases. Select the Link Binary with Libraries build phase and make sure the OpenGL framework is in that build phase. If it's not, drag the OpenGL framework from the Frameworks folder (click the disclosure triangle next to the project name in the Groups and Files list) to the Link Binary with Libraries build phase.

If you are linking the OpenGL framework, you may need to add a search path to the OpenGL framework. Select the name of your project from the Groups and Files list and click the Info button in the project window toolbar. This will open the project's information panel. Click the Build tab in the information panel. Choose Search Paths from the Collection popup menu. Add a path to the OpenGL framework to the Framework Search Paths build setting.

If that doesn't work, I don't know what to tell you. You may need to reinstall Xcode. Normally Xcode automatically knows about the OpenGL framework. All you have to do is add it to the project. And the SDL OpenGL template project should compile with no problems.
Mark Szymczyk
Author of Mac Game Programming and Xcode Tools Sensei
http://www.meandmark.com
Thanks for the reply.

I checked all the settings you mentioned to be sure (and are fine), but I don't think it is the project's setting any more because even the SDLOpenGL template project does not compile (which has certainly compiled in the past).

I will try reinstalling XCode, but perhaps I should also try replacing my OpenGL.framework in case it somehow became corrupt. Where would be a good place to download that do you think?

Worst comes to worst I could just reinstall OSX and start fresh...
The OpenGL framework comes with Mac OS X. I've never seen the framework available as a separate download so you would have to reinstall Mac OS X if reinstalling Xcode doesn't solve your problem.
Mark Szymczyk
Author of Mac Game Programming and Xcode Tools Sensei
http://www.meandmark.com

This topic is closed to new replies.

Advertisement