PDA

View Full Version : VC++ 7 compile error



harikishan7
05-31-2004, 08:42 PM
hello,

I am not new to OpenGL but this is my first program using the Visuak Studio .NET platform. I am getting an error which says
OpenGL fatal error LNK1104: cannot open file 'glaux32.lib'

here is the source code.
include <windows.h>
#include <GL/gl.h>
#include <GL/glut.h>
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "GLu32.lib")
#pragma comment(lib, "GLaux32.lib")

int a[3]={10,10,10}, b[3]={10,-10,10},
c[3]={-10,-10,10}, d[3]={-10,10,10},
e[3]={10,10,-10}, f[3]={10,-10,-10},
g[3]={-10,-10,-10}, h[3]={-10,10,-10};

float angle=1.0;

void drawcube(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);

glMatrixMode(GL_MODELVIEW);
glRotatef(angle, 0.0, 1.0, 0.0);
glBegin(GL_LINE_LOOP);
glVertex3iv(a);
glVertex3iv(b);
glVertex3iv(c);
glVertex3iv(d);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3iv(a);
glVertex3iv(e);
glVertex3iv(f);
glVertex3iv(b);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3iv(d);
glVertex3iv(h);
glVertex3iv(g);
glVertex3iv(c);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3iv(e);
glVertex3iv(f);
glVertex3iv(g);
glVertex3iv(h);
glEnd();

glFlush();
glutSwapBuffers();
}

void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 0x1B:
case 'q':
case 'Q':
exit(0);
break;
}
}

void mouse(int btn, int state, int x, int y)
{
if (state == GLUT_DOWN)
{
if (btn == GLUT_LEFT_BUTTON)
angle = angle + 1.0f;
else if (btn == GLUT_RIGHT_BUTTON)
angle = angle - 1.0f;
else
angle = 0.0f;
}
}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Glut rotate");
glutMouseFunc(mouse);
glutKeyboardFunc(keyboard);
glutDisplayFunc(drawcube);
glutIdleFunc(drawcube);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0);
glRotatef(30.0, 1.0, 0.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glClearColor(0.0, 0.0, 0.0, 0.0);

glutMainLoop();
return(0);
}

Any help would be greatly appreciated.

Thanks,
Hari Kishan

mikael_aronsson
05-31-2004, 10:44 PM
Hi !

If possible try to stay away from glaux, this is old junk that is no longer being used, but Visual Studio does include glaux library if you insist on using it.

Try changning the glaux32.lib to glaux.lib (in the linker properties) instead and see if that works, because that is the name of the library in Visual Studio.

Mikael

harikishan7
05-31-2004, 10:57 PM
Hi,

I tried changing the name to glaux.lib, but I still get the same error. Also I forgot to add in the first mail, I got an unusual message when i tried to compile the program(Ctrl F5) which says " these project configurations are out of date OpenGL Debug Win32 " I am not sure if this is normal coz when i click OK to debug the program I get a error message saying the system cannot find the path specified. then as usual i see the error message
OpenGL fatal error LNK1104: cannot open file 'glaux32.lib'

Waiting for a reply. Thanks in advance.

Hari..

parcalto
05-31-2004, 11:13 PM
Change
#pragma comment(lib, "GLaux32.lib")
to
#pragma comment(lib, "GLaux.lib")
works for me, at least I can build it without error. The result is a rotating cube. My environment is VS .Net 2003
Maybe you need to check you default library path?

dvm
06-01-2004, 12:35 AM
By the way, I don't see any glaux functions in your code. (I hope my eyes did not deceive me!) If that's the case, just remove the #pragma line. You don't need to include the library if you don't use it.

harikishan7
06-01-2004, 07:24 AM
Hi,

I think I got my default library path wrong. I am using MS Visual Studio 2003 on Windows XP. Can any one help me in installing the libraries correctly.

Thanks,
Hari..