• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with OpenGL MacTech code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with OpenGL MacTech code


  • Subject: Problem with OpenGL MacTech code
  • From: Matthew Lehrian <email@hidden>
  • Date: Tue, 29 Jan 2002 10:02:06 -0500

Hi all,

I'm having trouble getting the OpenGL example from MacTech (Jan '02) to
work. The code is below. I used a basic Cocoa Objective-C project and
added the GLUT.framework to the project, and my code. It seems pretty
simple, but I can't figure out why it won't link. I'm using MacOS X
10.1.2. Please help!

Here are the errors I get (the complete compile output is at the bottom
of this email):

/usr/bin/ld:
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/master.o illegal reference to symbol: _glBegin defined in
indirectly referenced dynamic library
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
/usr/bin/ld:
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/master.o illegal reference to symbol: _gluOrtho2D defined in
indirectly referenced dynamic library
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib

Here's the code:

<MyOpenGLView.h>

/* MyOpenGLView */

#import <Cocoa/Cocoa.h>

@interface MyOpenGLView : NSOpenGLView
{
}
@end

</MyOpenGLView.h>

<MyOpenGLView.m>

#import "MyOpenGLView.h"
#import <GLUT/glut.h>

@implementation MyOpenGLView

- (void)drawRect: (NSRect) theRect
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0., 2., 0., 1.);

glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);

glColor3f(0.0, 0.0, 1.0);
glLineWidth(1.0);

glBegin(GL_LINE_LOOP);
glVertex2f(0.05, 0.05);
glVertex2f(1.95, 0.05);
glVertex2f(1.80, 0.85);
glVertex2f(0.20, 0.85);
glEnd();

glFlush();
}

@end

</MyOpenGLView.m>

<Complete Compile Output>

/usr/bin/jam -d1
JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase
JAMFILE=- build ACTION=build TARGETNAME=OpenGLWithCocoa NATIVE_ARCH=ppc
BUILD_STYLE=Development
CPP_HEADERMAP_FILE=/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/
OpenGLWithCocoa.build/Headermaps/OpenGLWithCocoa.hmap DSTROOT=/
OBJROOT=/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates
SRCROOT=/Users/matthewl/Projects/OpenGLWithCocoa
SYMROOT=/Users/matthewl/Projects/OpenGLWithCocoa/build
warning: <OpenGLWithCocoa>OpenGLWithCocoa.app depends on itself
...updating 11 target(s)...
BuildPhase OpenGLWithCocoa.app
Completed phase <CopyHeaders> for OpenGLWithCocoa.app
Cp
/Users/matthewl/Projects/OpenGLWithCocoa/build/OpenGLWithCocoa.app/Contents/
PkgInfo
BuildPhase OpenGLWithCocoa.app
Completed phase <CopyResources> for OpenGLWithCocoa.app
CompileC
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/Objects/ppc/MyOpenGLView.o
BuildPhase OpenGLWithCocoa.app
Completed phase <DeriveAndCompileSources> for OpenGLWithCocoa.app
MasterObjectFile.Combine
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/master.o
StandaloneExecutable
/Users/matthewl/Projects/OpenGLWithCocoa/build/OpenGLWithCocoa.app/Contents/
MacOS/OpenGLWithCocoa
/usr/bin/ld:
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/master.o illegal reference to symbol: _glBegin defined in
indirectly referenced dynamic library
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
/usr/bin/ld:
/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/master.o illegal reference to symbol: _gluOrtho2D defined in
indirectly referenced dynamic library
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib

/usr/bin/cc -o
"/Users/matthewl/Projects/OpenGLWithCocoa/build/OpenGLWithCocoa.app/Contents/
MacOS/OpenGLWithCocoa"
"-L/Users/matthewl/Projects/OpenGLWithCocoa/build"
"-F/Users/matthewl/Projects/OpenGLWithCocoa/build" -filelist
"/Users/matthewl/Projects/OpenGLWithCocoa/build/intermediates/OpenGLWithCocoa.
build/Objects/LinkFileList" "-arch" "ppc" "-prebind" "-framework"
"Cocoa" "-framework" "GLUT"

...failed StandaloneExecutable.LinkUsingFileList
/Users/matthewl/Projects/OpenGLWithCocoa/build/OpenGLWithCocoa.app/Contents/
MacOS/OpenGLWithCocoa ...

</Complete Compile Output>


  • Follow-Ups:
    • Re: Problem with OpenGL MacTech code
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Re: Drawing shadows?
  • Next by Date: [TIP] Grabbing all methods from First Responder
  • Previous by thread: Color swatch in NSMenuItem
  • Next by thread: Re: Problem with OpenGL MacTech code
  • Index(es):
    • Date
    • Thread