code not working

hi
written in VC++ as a simple text application. it is to load abmp image in opengl. it gives the following errors:

--------------------Configuration: main - Win32 Debug--------------------
Linking…
main.obj : error LNK2001: unresolved external symbol _auxDIBImageLoadA@4
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

main.exe - 2 error(s), 0 warning(s)

here is the code:

#include<stdio.h>
#include<GL/glaux.h>
#include<GL/glut.h>
#include<windows.h>

void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

void reshape(int w, int h)
{
glViewport(0,0,(GLsizei) w,(GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(50.0,50.0,-50.0,-50.0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

GLuint LoadGLTexture(char *filename,int filter) // Load Bitmaps And Convert To Textures
{
GLuint tempadd; // Storage for one texture
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture

memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
if (filter > 2) //Invaild filter
{
exit(1);
}

if (TextureImage[0]==auxDIBImageLoad(filename))
{
glGenTextures(1, &tempadd); //Setup storage
glBindTexture(GL_TEXTURE_2D, tempadd);
if (filter==0)
{
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
}

if (filter==1)
{
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]-&gt;sizeX, TextureImage[0]-&gt;sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]-&gt;data);
}

if (filter==2)
{
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
	gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]-&gt;sizeX, TextureImage[0]-&gt;sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]-&gt;data);
}

if (TextureImage[0]) // If Texture Exists
{
  if (TextureImage[0]-&gt;data) // If Texture Image Exists
		free(TextureImage[0]-&gt;data); // Free The Texture Image Memory
	free(TextureImage[0]); // Free The Image Structure
 }

}
return tempadd; // Return The Texture Structure

}

int main(int argc,char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow(“Spiderman”);
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
GLuint newtex;
newtex = LoadGLTexture(“bubbles.bmp”,2);
glBindTexture(GL_TEXTURE_2D,newtex);
glutMainLoop();
return 0;
}

thanks a lot in advance!!!
anxious yet again

You probably forgot to link to glaux.lib.

Right-click on your project in the workspace window and choose settings. Now, go to the Link tab.

In one of the fields, you should see a lot of .lib files (these are the libraries you link to). There should be opengl32.lib for example.

Simply add glaux.lib to the list and recompile your project: the error should be gone !

Hope this helps.

Regards.

Eric

Since you’re using glut, you probably won’t see opengl32.lib in the list of libraries. The glut header has lines like

#pragma comment(lib, opengl32.lib)

that will do the same thing as adding the libraries to the project. glAux.lib isn’t one that glut.h adds, though so you will need to add that to your project. (Or use a line like the one above, but I tend to just add it to the project.)

Also, if you add it to the project be sure to do it for both the debug and release configurations.