Error trying to link an OpenGL app

Member
Posts: 26
Joined: 2006.09
Post: #1
This is not 100% OpenGL question, sorry for the slight offtopicness.

Anyways, I had perfectly working OpenGL app which compiles and runs nicely in Debug mode. But now that I try to compile it in Release the linker starts to complain about missing symbols as follows at the end of the post.

To me it looks like the PPC part of the universal builds just fine, but the linker chokes to the i386 portion.

/usr/bin/ld: warning /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/Cocoa.framework/Cocoa cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning /Developer/SDKs/MacOSX10.3.9.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: Undefined symbols:
.objc_class_name_NSApplication
.objc_class_name_NSAutoreleasePool
.objc_class_name_NSMenu
.objc_class_name_NSMenuItem
.objc_class_name_NSObject
.objc_class_name_NSProcessInfo
.objc_class_name_NSString
_CFBundleCopyResourcesDirectoryURL
_CFBundleGetInfoDictionary
_CFBundleGetMainBundle
_CFRelease
_CFURLGetFileSystemRepresentation
_CPSEnableForegroundOperation
_CPSGetCurrentProcess
_CPSSetFrontProcess
_NSAllocateMemoryPages
_NSApp
_NSDeallocateMemoryPages
___CFConstantStringClassReference
_objc_msgSend
_glBlendFunc
_glClear
_glClearColor
_glColor3ub
_glColor4ub
... and the list goes on for every OpenGL function I called

[edit] It seems to complain about the cpu type mismatch in Debug build too but it compiles and runs fine. That started to happen when I added the OpenGL.framework to my program. I used to the SDL atlantis example as basis for my project and the project did not include the opengl framework, but I added it as the first solution to try to get the Release build working.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
You'll need to link against /Developer/SDKs/MacOSX10.4u.sdk for the i386 build. MacOSX10.3.9.sdk is ppc only. Presumably, it works in Debug mode because you have ZeroLink on, which processes linking differently.
Quote this message in a reply
Member
Posts: 26
Joined: 2006.09
Post: #3
That kind makes sense. If I look at the paths in the compiler output some are pointing to the 10.3.9 and some are pointing to 10.4u. How can I ensure that the correct paths are being used?
Quote this message in a reply
Member
Posts: 111
Joined: 2002.06
Post: #4
Open your project's information panel by selecting the name of the project from the Groups and Files list and clicking the Info button on the project window toolbar. Click the General tab in the information panel. You should see a menu named Cross-Develop Using Target SDK. Choose Mac OS X 10.4 (Universal).

Clean your project's targets and rebuild your project. Xcode should use the 10.4 SDK to build your project.

Mark Szymczyk
http://www.meandmark.com
Quote this message in a reply
Member
Posts: 26
Joined: 2006.09
Post: #5
I found the cuplrit.

The framework search paths looks like this when I edit them:
FRAMEWORK_SEARCH_PATHS = $(inherited) $(FRAMEWORK_SEARCH_PATHS_QUOTED_1) $(FRAMEWORK_SEARCH_PATHS_QUOTED_2)

The $(FRAMEWORK_SEARCH_PATHS_QUOTED_1) seems to be that bad one pointing to the old framework directory. If I remove it it works! Where does those defines come from?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Strange OpenGl or NSBitmapImageRep error magnusrw 4 3,186 Apr 24, 2009 11:13 AM
Last Post: magnusrw
  display link to drive opengl loop? alloca 21 8,642 Jan 21, 2009 10:56 PM
Last Post: arekkusu
  bus error with opengl code mnorton 2 3,754 Jan 21, 2005 02:53 PM
Last Post: ThemsAllTook
  Link error NormH 6 3,004 Jan 16, 2005 03:48 PM
Last Post: NormH
  Texturing with OpenGL & Cocoa (link) Taxxodium 0 2,390 Dec 2, 2004 06:31 AM
Last Post: Taxxodium