Errors with Texture2D

Apprentice
Posts: 5
Joined: 2009.01
Post: #1
Hi,

I'm a total newb to mac/iphone/opengl development. I have lots of other programming experience, but not with any of this stuff specifically... I read through the Beginning iPhone Development book, and wanted to start playing around with making a game.

I originally wanted to use Quartz since I didn't want to do any 3d stuff, but after looking around on the forums here and mulling it over, I thought I'd try going the opengl route, at least to see for myself how it works before doing more mucking about with Quartz so I could get a better feel for the two.

Anyway, in the book there;s a chapter on quartz and opengl, and the authors included the Texture2D class, which I see was in that crash landing demo that apple removed (which probably would have been awesome to look at...grrr). Anyway, that class works following the book code, but when I tried to load a new OpenGl project from XCode, and then add in Texture2D, I get 18 errors - without doing anything other than adding the two (.h, .m) to the project.

Does this make sense to anyone? Has anyone else seen these errors? I was wanted to play with the generated OpenGl project since it already had the timer stuff set up, vs the book code (where the texture2d class works) which didn't. I can probably put the timer stuff into the view class from there, but I thought starting from the freshly generated project would be the 'cleaner' approach.

Anyway, these are the errors. I don't really understand them (as I said, I'm new to opengl, obj-c, and mac development... ), so I'm curious if anyone else had this problem with a new project. This is a new OpenGLES project from Xcode with the build set to iPhone Simulator 2.2. I didn't change any of the frameworks or anything like that. If I just build the completely empty project, I get a screen with a rotating colored square, so everything works before I copy in those two files. Is there something I should change to make this class work?

Thanks.. sorry for the essay post. Rasp

Code:
Building target “GLMovingImageTest” of project “GLMovingImageTest” with configuration “Debug” — (18 errors)
        cd "/Users/davidb/Documents/Xcode Workspace/GLMovingImageTest"
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.sdk "-L/Users/davidb/Documents/Xcode Workspace/GLMovingImageTest/build/Debug-iphonesimulator" "-F/Users/davidb/Documents/Xcode Workspace/GLMovingImageTest/build/Debug-iphonesimulator" -filelist "/Users/davidb/Documents/Xcode Workspace/GLMovingImageTest/build/GLMovingImageTest.build/Debug-iphonesimulator/GLMovingImageTest.build/Objects-normal/i386/GLMovingImageTest.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -o "/Users/davidb/Documents/Xcode Workspace/GLMovingImageTest/build/Debug-iphonesimulator/GLMovingImageTest.app/GLMovingImageTest"
Undefined symbols:
  "_CGContextRelease", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGAffineTransformScale", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGColorSpaceRelease", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGContextSetGrayFillColor", referenced from:
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGContextDrawImage", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGContextTranslateCTM", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGBitmapContextCreate", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGAffineTransformIsIdentity", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGImageGetColorSpace", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGContextScaleCTM", referenced from:
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGContextClearRect", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGColorSpaceCreateDeviceGray", referenced from:
      -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
  "_CGAffineTransformIdentity", referenced from:
      _CGAffineTransformIdentity$non_lazy_ptr in Texture2D.o
  "_CGImageGetAlphaInfo", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGContextConcatCTM", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGColorSpaceCreateDeviceRGB", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGImageGetWidth", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
  "_CGImageGetHeight", referenced from:
      -[Texture2D(Image) initWithImage:] in Texture2D.o
      -[Texture2D(Image) initWithImage:] in Texture2D.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
          "_CGContextRelease", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGAffineTransformScale", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGColorSpaceRelease", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGContextSetGrayFillColor", referenced from:
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGContextDrawImage", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGContextTranslateCTM", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGBitmapContextCreate", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGAffineTransformIsIdentity", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGImageGetColorSpace", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGContextScaleCTM", referenced from:
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGContextClearRect", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGColorSpaceCreateDeviceGray", referenced from:
              -[Texture2D(Text) initWithString:dimensions:alignment:fontName:fontSize:] in Texture2D.o
          "_CGAffineTransformIdentity", referenced from:
              _CGAffineTransformIdentity$non_lazy_ptr in Texture2D.o
          "_CGImageGetAlphaInfo", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGContextConcatCTM", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGColorSpaceCreateDeviceRGB", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGImageGetWidth", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
          "_CGImageGetHeight", referenced from:
              -[Texture2D(Image) initWithImage:] in Texture2D.o
              -[Texture2D(Image) initWithImage:] in Texture2D.o
        ld: symbol(s) not found
        collect2: ld returned 1 exit status
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #2
You need to add CoreGraphics.framework to your project.
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2009.01
Post: #3
LOL that's all?!? Mad

just added it and it works. thanks!!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Texture2d crash lander ajrs84 0 2,838 Apr 1, 2012 08:54 AM
Last Post: ajrs84
  Problem using Texture2D sub-section bendell 0 2,489 Mar 20, 2010 02:06 AM
Last Post: bendell
  Create a texture2d with contents of other textures godexsoft 6 4,679 Nov 12, 2009 10:24 PM
Last Post: godexsoft
  OpenGL ES and Texture2D Talyn 37 31,979 Jul 30, 2009 09:34 AM
Last Post: Splat21
  Texture2d with strings kendric 10 5,500 Jul 14, 2009 09:28 PM
Last Post: warmi