Advertisement

Problems with Lesson 6 and up

Started by September 12, 2005 06:56 PM
11 comments, last by Twisol 19 years, 2 months ago
I can't compile any tutorial code other than Lessons 1-5, as Dev-C++ is geting me tons of linker errors. Here's my error log, with repeated enries taken out...

  [Linker error] undefined reference to `_imp__CreateCompatibleDC@4' 
  [Linker error] undefined reference to `_imp__CreateDIBSection@24' 
  [Linker error] undefined reference to `_imp__SelectObject@8' 
  [Linker error] undefined reference to `_imp__SetDIBits@28' 
  [Linker error] undefined reference to `_imp__GdiFlush@0' 
  [Linker error] undefined reference to `_imp__DeleteDC@4' 
  [Linker error] undefined reference to `_imp__DeleteObject@4' 
  [Linker error] undefined reference to `_imp__GetStockObject@4' 
  [Linker error] undefined reference to `_imp__SetPaletteEntries@16' 
  [Linker error] undefined reference to `_imp__GetPaletteEntries@16' 
  [Linker error] undefined reference to `_imp__SelectPalette@12' 
  [Linker error] undefined reference to `_imp__RealizePalette@4' 
  [Linker error] undefined reference to `_imp__SetSystemPaletteUse@8' 
  [Linker error] undefined reference to `_imp__CreatePalette@4'   
  [Linker error] undefined reference to `_imp__DescribePixelFormat@16' 
  [Linker error] undefined reference to `_imp__UnrealizeObject@4' 
  [Linker error] undefined reference to `_imp__GetPixelFormat@4' 
  [Linker error] undefined reference to `_imp__DescribePixelFormat@16' 
  ld returned 1 exit status


:(
what does your linker command look like? (your forgetting to include a library, i just dont know which one)
- relpats_eht
Advertisement
Try posting some source code or specify which tutorial you are using.
Im also using Dev C++ and the same problem happened to me at that step. At the bottom of each lesson there is a code for each of the compilers there, most of the beginning ones are Dev, and others are compilers like Microsoft Visual, so make sure to download a translated Dev code and not to download another one becasue dev will read it as nonsense that will not compile.
sorry let em rephrase my second sentence. I was using Open GL when that happened. but at the end of each lesson there is a list of compilers that has the exact definition of code but translated in a way each compiler can read it as. I think all of the lessons has Visual in their list while soem has Dev.
Relpats_eht (backwords "the_stapler? :P), I'm including these flags: -lgdi32 -lopengl32 -lglu32 -lglaux

Ender: Tutorial 6 of NeHe's tutorials.

Lasko: I downloaded Lesson 6 and tried compiling, but I still get these linker errors.
Advertisement
Ok, someone on cprogramming.com's forums helped me fix it. But now when I run the Lesson 6 code, it says "Initialization Error". I think the problem's originating here:

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/NeHe.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}


I think the first "if" isn't going through, and that's why it's returning false to InitGL(), which in turn returns false to CreateGLWindow(), which returns false to WinMain(), thus closing the program...
I compared your snippet to my code, but what you've shown is identical to my code (which does compile within devcpp). It must be something else.
You did remember to set the project as Win32 GUI, right?
I just happened to see a nearly identical post (initialization error).
You do have your texture available, right? Within the specified directory "Data/NeHe.bmp", remembering that the name is case-sensitive, and this will search the same directory the .exe is running from for the data directory.

If I remember right, I started out with this problem. The downloadable code from the nehe site has the texture available if you don't know how to make it, or don't feel like making it (heh, I'm a little bit of A, and a little bit of B, personally).
I downloaded the Lesson 6 code directly from its lesson page. And yes, I have the Windows GUI selected (that's how I got past the linker errors just now), and yes, I downloaded the Dev-C++ code and not another compiler's code.

This topic is closed to new replies.

Advertisement