Quadratics

Started by
4 comments, last by Codorke 19 years, 1 month ago
Hi, I'm having problems with quaqratics. My compiler gives me always this error : error C2061: syntax error : identifier 'gluNewQuadric' my code : #pragma once #include <windows.h> // Header File For Windows #include <gl\gl.h> // Header File For The OpenGL32 Library #include <gl\glu.h> // Header File For The GLu32 Library #include <gl\glaux.h> // Header File For The GLaux Library GLUquadricObj *Quadratic = new gluNewQuadric(); GLUquadricNormals(Quadric, GLU_SMOOTH); I'm using Microsoft Visual C++ .NET (just information) Does anyone reconise this error, or know how to fix it ? Thanks
Advertisement
Quote:GLUquadricObj *Quadratic = new gluNewQuadric();


You need to remove the 'new' in this line. gluNewQuadric is a function.
Quote:GLUquadricObj *Quadratic = new gluNewQuadric();
GLUquadricNormals(Quadric, GLU_SMOOTH);


gluNewQuadric() returns a pointer to a quadric object, so don't use the new operator. And they are also called "quadrics" and not "quadratics," so to be consistent that first line should be (especially since you use Quadric in the second line)...
GLUquadricObj *Quadric = gluNewQuadric();


Also the second line should be...
gluQuadricNormals(Quadric, GLU_SMOOTH);
with lower-case "glu" and upper-case "Q"

EDIT: Typo
Thanks for the replies but i still have some errors.

Now the pronlem is solved about the new operator but not with the gluQuadraticNormals :
error C2501: 'gluQuadricNormals' : missing storage-class or type specifiers
error C2365: 'gluQuadricNormals' : redefinition; previous definition was a
'function'
error C2078: too many initializers



GLUquadricObj *Quadric = gluNewQuadric();
gluQuadricNormals(Quadric, GLU_SMOOTH);

What's wrong this time ?


gluQuadricNormals needs to be called inside of a function. Calling it outside of one as you do now makes the compiler thinks it's a function declaration
Thanks, putting it into a function solved my problem ...

This topic is closed to new replies.

Advertisement