Problems loading a bitmap

Hi all,

I’ve recently decided to learn about OpenGL in an attempt to create a nice looking program for extra credit in my GUI/OOP class. I’ve been going through the tutorials @ http://nehe.gamedev.net/ but there is a problem beginning at Lesson 6. The code given to load a bitmap gives a compile error stating "expected constructor, destructor, or type conversion before ‘*’ token. Below, I’ve listed the line generating the error. Any ideas?

AUX_RGBImageRec *LoadBMP(char *Filename)  

Hi BrandonLP,
I believe AUX_RGBImageRec is a part of glaux library. And, glaux library is now obsolete. So, it is better not to use glaux.

However, if you still want to work with it (at least to compile the Nehe tutorial), search for glaux.h and its library (dll or lib). If you cannot find one, let me know.

I have the headerfile in the include\GL folder, but it still doesn’t seem to be working.

Do you also have the library file? (glaux.dll or glaux.lib)

I have them, but they’re in a directory for Win2k Server SDK. Where should I copy them to?

Copy “glaux.lib” into the same folder where your source codes are. Then add the following line at the top of your source code(C/C++):

// link static glaux library
#pragma comment(lib, "glaux.lib")
...
// include headers
...

It is static library and merged into exe, so you don’t need the DLL to run your executable.

Still getting this error:

66 C:\Documents and Settings\Brandon\Desktop\opengl\lesson26\Lesson26.cpp expected constructor, destructor, or type conversion before ‘*’ token

Here’s the entire block of code:

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
}

Also, if this method is antequated, I wouldn’t be against learning a new way to do it.

We at NeHe are aware of the problem, the original lesson was written a long time ago, we have since rewritten it totally, it’s now a sweet and lightweight tga loader (even i who wrote it was amazed by it’s sweetness), but it’s yet to be released, so in the meantime we made this temporary fix.
glAux fix