strange error on include

Started by
2 comments, last by rick_appleton 20 years, 8 months ago
when i compile the following code header:

#ifndef AFX_OGLTEXTUREMANAGER_H
#define AFX_OGLTEXTUREMANAGER_H

#define TEXMANAGER COGLTextureManager::GetInstance()

class COGLTextureManager
{
public:
  static COGLTextureManager& GetInstance(void) { return *manager; };

private:
	COGLTextureManager( void );
  ~COGLTextureManager( void );
private:
  static COGLTextureManager* manager;

  int           nofTexturesUsed;
  int           nofTexturesMax;
};

#endif // AFX_OGLTEXTUREMANAGER_H

source

#include "OGLTextureManager.h"
#include "GL/gl.h"
#include "GL/glu.h"
#include <stdio.h>

// These defines are used to tell us about the type of TARGA file it is

#define TGA_RGB			2		// This tells us it's a normal RGB (really BGR) file

#define TGA_A				3		// This tells us it's a ALPHA file

#define TGA_RLE		 10		// This tells us that the targa is Run-Length Encoded (RLE)


#define EXTEND_NOFTEXTURES_BY 4
COGLTextureManager *COGLTextureManager::manager = 0;

//////////////////////////////////////////////////////////////////////

// Public Member Functions

//////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////

// Private Member Functions

//////////////////////////////////////////////////////////////////////


COGLTextureManager::COGLTextureManager()
{
  nofTexturesUsed = 0;
  nofTexturesMax  = 4;
}

COGLTextureManager::~COGLTextureManager()
{
}
I get this compiler error: c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void' c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found including windows.h to the header file removes the error, but I have no idea why. could anyone shed some light on this? [edited by - rick_appleton on August 7, 2003 7:20:15 PM]
Advertisement
You need to include SDL_opengl.h, I believe. It will take care of that for you.
You need to include windows.h before including gl.h.
---I write code.DelphiGL (http://delphigl.cfxweb.net)
Forgot to mention:

The gl headers require the Windows header to be included. If you are writing the game for Windows, its not a problem. If you are trying to make it cross platform, you will need to use SDL or an equivilent. You could also just do:

#ifdef WINDOWS
#include "Windows.h"
#endif

This topic is closed to new replies.

Advertisement