Archived

This topic is now archived and is closed to further replies.

joey81

linking error

Recommended Posts

joey81    122
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); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } 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...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
It sounds like what the last person suggested. You aren''t linking glaux.lib
I''ve found that LNK2001 usually means I''ve forgotten to link to a library.

Linking to a library is really easy to do if you are using VC++ Just go into the Project menu and choose settings.
Next choose the Link tab.
In the dialog box labeled Object/Library models insert glaux.lib
There you have it.

T-Lann

Share this post


Link to post
Share on other sites
glGreenhorn    122
whose compiler are using?? if you''re using Borland''s compiler, you need to get yourself the Borland version of glaux.lib. this is a messy matter, by the way. so if you do have a Borland compiler, let me know and i''ll tell you what i did to get it to work.

keep cool

Share this post


Link to post
Share on other sites
Eber Kain    130
for loading graphics, i higly reccomend useing devil

openil.sourceforge.net




:::: example ::::


unsigned int loadtex(char*name) {
unsigned int img,texture;
ilGenImages(1, &img);
ilBindImage(img);
ilLoadImage(name);
texture = ilutGLBindMipmaps();
ilDeleteImages(1, &img);
return texture;
}

//on init call
glEnable(GL_TEXTUE_2D);
texture = loadtex("gfx.jpg");

//in draw code call
glBindTexture(GL_TEXTURE_2D,texture);
DrawModel();

Share this post


Link to post
Share on other sites