View Full Version : linking error

12-17-2001, 09:37 PM
AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
FILE *File=NULL; // File Handle

if (!Filename) // Make Sure A Filename Was Given
return NULL; // If Not Return NULL

File=fopen(Filename,"r"); // Check To See If The File Exists

if (File) // Does The File Exist?
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer

return NULL; // If Load Failed Return NULL

int LoadGLTextures() // Load Bitmaps And Convert To Textures
int Status=FALSE; // Status Indicator

AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture

memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL

// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
if (TextureImage[0]=LoadBMP("Data/Wall.bmp"))
Status=TRUE; // Set The Status To TRUE

glGenTextures(1, &texture[0]); // Create The Texture

// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);

if (TextureImage[0]) // If Texture Exists
if (TextureImage[0]->data) // If Texture Image Exists
free(TextureImage[0]->data); // Free The Texture Image Memory

free(TextureImage[0]); // Free The Image Structure

return Status; // Return The Status

this is my code for rendering a wall.bmp onto a cube....
I'm stuck with this linking error when i try to compile my pgm....

3D Cube.obj : error LNK2001: unresolved external symbol _auxDIBImageLoadA@4
Debug/3D Cube.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Can anyone help???
Thanks in advance...

12-17-2001, 11:25 PM
Are you working on Microsoft Visual C++ ?
I think so.
So the problem is that you have not linked to the aux library.
Do it be adding the following line on top of your code

#pragma comment(lib, "glaux.lib")

or do the linking manually from the
Project -> Settings -> Link
and search for the text box with other libs.
Add "glaux.lib" (withOUT the ") in front of kernel32.lib.

I think that will solve your problem.


Leyder Dylan
12-18-2001, 10:42 AM
It's not "I think that it solves your problem" but it's the solution .