Skip to main content
gamedev.net
🔒 Locked

Model Loader errors

Started by Sir Sapo Jan 21, 2005 at 11:20 AM 3 replies 650+ views
Original Post
Sir Sapo
Sir Sapo
I am trying to get the Model Loader from Nehe's Tutorial 31 to work, but I keep getting errors. The first error I get is this: implicit declaration of function "int free()" this is at the lines of code that say:

GLuint LoadGLTexture( const char *filename )						// Load Bitmaps And Convert To Textures
{
	AUX_RGBImageRec *pImage;										// Create Storage Space For The Texture
	GLuint texture = 0;												// Texture ID

	pImage = LoadBMP( filename );									// Loads The Bitmap Specified By filename

	// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
	if ( pImage != NULL && pImage->data != NULL )					// If Texture Image Exists
	{
		glGenTextures(1, &texture);									// Create The Texture

		// Typical Texture Generation Using Data From The Bitmap
		glBindTexture(GL_TEXTURE_2D, texture);
		glTexImage2D(GL_TEXTURE_2D, 0, 3, pImage->sizeX, pImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pImage->data);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

		free(pImage->data);											// Free The Texture Image Memory
		free(pImage);												// Free The Image Structure
	}

	return texture;													// Return The Status
}

When I remove the lines of code that reference the free function(probably not a good idea) I get a lot of linker errors that have t do with an undefined reference to ifstream::(etc , etc). Does anyone know what is wrong?
My Current Project Angels 22 (4E5)
nife
nife
Include

/* Just to inform you: The function/functions you are currently making is a texture loader (texture, in most cases, means a loaded image). A model loader relates to a bunch of 2D or 3D vertices (maybe with keyframes and such), like the OBJ, 3DS, MD2, MD3 or MD5 formats. */ Skip

Also, you shouldn't use GLAUX, since it contains a lot of memory leaks (memory that isn't freed), after what I've heard.
Read on to lesson 17 (I think), where you learn to load an image without GLAUX (although it loads tga's, it can easily be converted to a bmp loader).

Visit www.wotsit.org for the most common file format details.

You can also just visit my site for fully functional texture loaders:
http://www.nife.1go.dk/C++/LoadBMPFile.txt
http://www.nife.1go.dk/C++/LoadTGAFile.txt

EDIT: Just skip the second paragraph, I thought you wrote lesson 13 ;-)

[Edited by - nife on January 21, 2005 11:35:21 AM]
Killers don't end up in jailThey end up on a high-score!
Sir Sapo
Sir Sapo
Sorry if my question wasn't very clear , I am trying to get the Model Loader to work , that snippet I posted was just the part of the loader giving me trouble. Anyways , I included and the implicit free thing went away, but I still have all these linker errors.


c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text+0x1cf):milkshapemodel: undefined reference to istream::seekg(long, ios::seek_dir)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text+0x1e1):milkshapemodel: undefined reference to
istream::tellg(void)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text+0x201):milkshapemodel: undefined reference to istream::seekg(long, ios::seek_dir)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text+0x23b):milkshapemodel: undefined reference to
istream::read(char *, int)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text+0x24a):milkshapemodel: undefined reference to fstreambase::close(void)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text$__8ifstreamiPCcii+0xab):milkshapemodel: undefined reference to
fstreambase::fstreambase(int, char const *, int, int)'
c:\documents and settings\thomas\desktop\model loader\lesson31\milkshapemodel.o(.text$_$_11fstreambase+0x60):milkshapemodel: undefined reference to `filebuf::~filebuf(void)'


EDIT**
I am using Dev C++ btw , if that helps any
My Current Project Angels 22 (4E5)
Sir Sapo
Sir Sapo
Yeah , is included in the model class , which the MilkshapeModel class is derived from.
My Current Project Angels 22 (4E5)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.