PDA

View Full Version : Some new errors



04-10-2002, 07:57 AM
Hello. I'm trying to compile "Red Book" code samples in VC++ 6, but it gives me that errors:

C:\Archivos de programa\Microsoft Visual Studio\MyProjects\test2\test1.cpp(41) : error C2664: 'auxReshapeFunc' : cannot convert parameter 1 from 'void (int,int)' to 'void (__stdcall *)(int,int)'
None of the functions with this name in scope match the target type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\test2\test1.cpp(42) : error C2664: 'auxMainLoop' : cannot convert parameter 1 from 'void (void)' to 'void (__stdcall *)(void)'
None of the functions with this name in scope match the target type

¿some ideas?

----------------------------

The source code is: (viewing chapter)

void display (void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity (); /* clear the matrix */
glTranslatef (0.0, 0.0, -5.0); /* viewing transformation */
glScalef (1.0, 2.0, 1.0); /* modeling transformation */
auxWireCube(1.0); /* draw the cube */
glFlush();
}

void myinit (void)
{
glShadeModel (GL_FLAT);
}

void myReshape(GLsizei w, GLsizei h)
{
glMatrixMode (GL_PROJECTION); /* prepare for and then */
glLoadIdentity (); /* define the projection */
glFrustum (-1.0, 1.0, -1.0, 1.0, /* transformation */
1.5, 20.0);
glMatrixMode (GL_MODELVIEW); /* back to modelview matrix */
glViewport (0, 0, w, h); /* define the viewport */
}


int main(int argc, char** argv)
{
auxInitDisplayMode (AUX_SINGLE | AUX_RGBA);
auxInitPosition (0, 0, 500, 500);
auxInitWindow (argv[0]);
myinit ();
auxReshapeFunc (myReshape);
auxMainLoop(display);
}

nexusone
04-10-2002, 08:18 AM
You must have an old opengl red book, the newer versions have replaced the old glaux.lib with glut.lib.

I think your problem could be the glaux.lib you have, it could be compiled for a older version of VC or the wrong version of the glaux.h.

Best not to use the glaux since it is no longer supported, convert the examples to the glut version of the glaux commands.

Here is a link to the newer version of the opengl red book that is on-line: http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/@Generic__BookView;cs=fullhtml



Originally posted by McOwen:
Hello. I'm trying to compile "Red Book" code samples in VC++ 6, but it gives me that errors:

C:\Archivos de programa\Microsoft Visual Studio\MyProjects\test2\test1.cpp(41) : error C2664: 'auxReshapeFunc' : cannot convert parameter 1 from 'void (int,int)' to 'void (__stdcall *)(int,int)'
None of the functions with this name in scope match the target type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\test2\test1.cpp(42) : error C2664: 'auxMainLoop' : cannot convert parameter 1 from 'void (void)' to 'void (__stdcall *)(void)'
None of the functions with this name in scope match the target type

¿some ideas?

04-10-2002, 02:39 PM
Yes,you are right. I have no problems when usign glut library.
Thanks for your help!

kabir
04-10-2002, 03:18 PM
If I'm remembering error messages properly the problem is that the code in your glAux library is using standard C mangling on the names but your compiler is probably defaulting to C++... you can enclose your example code in an extern "c" {} block, or adjust the settings of your compiler to mangle the names differently. (Somewhere under project settings in VC++).