always hopefull

Started by
7 comments, last by Drew_Benton 18 years, 6 months ago
I think the proper links have been made to the needed files. I can compile the examples are run them just fine. I again tried copying the example from chapter 2 word for word and file for file, and I get this error as well. ....Perhaps my gl.h include file is old? Actually it can't be, because the examples compile fine. I am using the WinMain from the book, "Beginning OpenGL Programming" and I will add it at the end here as well. To be specific to only difference is the class name that I use instead of what the book uses. I have killed too many hours comparing and trying to figure this out, I know what the errors mean but not why they are happening. Feels like I have just started programming, but I have been going it for years. I'm using ms visual c++ 6.0 -------------------------------------------------------------------------- NaturalResponse.cpp 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 Error executing cl.exe. NaturalResponse.obj - 3 error(s), 0 warning(s) /* WIN_specular_fog */ #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC /* For compatibility with OpenGL v1.0 */ #define GL_LOGIC_OP GL_INDEX_LOGIC_OP #define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT /*************************************************************/ //Error happens here. /*************************************************************/ WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value); WINGDIAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref); WINGDIAPI GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); WINGDIAPI void APIENTRY glArrayElement (GLint i); WINGDIAPI void APIENTRY glBegin (GLenum mode); WINGDIAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); WINGDIAPI void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); WINGDIAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); WINGDIAPI void APIENTRY glCallList (GLuint list); WINGDIAPI void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists); WINGDIAPI void APIENTRY glClear (GLbitfield mask); --------------------------------------------------------------------------------- #define WIN32_LEAN_AND_MEAN #define WIN32_EXTRA_LEAN #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> #include "NaturalResponse.h" bool exiting = false; long windowWidth = 800; long windowHeight = 600; long windowBits = 32; bool fullscreen = true; HDC hDC; NaturalResponse *g_glRender = NULL; void SetupPixelFormat(HDC hDC) { int pixelFormat; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // size 1, // version . . . . . } LRESULT CALLBACK MainWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static HDC hDC; static HGLRC hRC; int height, width; // dispatch messages switch (uMsg) { case WM_CREATE: // window creation hDC = GetDC(hWnd); . . . . } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { WNDCLASSEX windowClass; // window class HWND hwnd; // window handle MSG msg; // message DWORD dwExstyle; // Window Extended style DWORD dwstyle; // Window style RECT windowRect; g_glRender = new NaturalResponse; . . . . }
Advertisement
Maybe #include<windows.h> before gl.h would help.
It looks like WINGDIAPI isn't found you'll probably need to move:
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);WINGDIAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref);WINGDIAPI GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);WINGDIAPI void APIENTRY glArrayElement (GLint i);WINGDIAPI void APIENTRY glBegin (GLenum mode);WINGDIAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);WINGDIAPI void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);WINGDIAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);WINGDIAPI void APIENTRY glCallList (GLuint list);WINGDIAPI void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists);WINGDIAPI void APIENTRY glClear (GLbitfield mask);


below:

#include <windows.h>#include <gl/gl.h>#include <gl/glu.h>
Don't the files that call gl.h already have
#include <windows>?
just do it, and you'll be fine :)
I'll give it a try, but it doesn't explain why other examples structured the same way work without this error. I don't mean to sound defeated, but it is starting to feel that way.
I dont know how the other examples look like. I just know that, on win, you have to include <windows.h> before <gl.h>. You're on windoze, so you're using a win implementation of opengl, so you need to include <windows.h>...or something :)
#include <windows.h> is in there.
1st try taking out the:
#define WIN32_LEAN_AND_MEAN#define WIN32_EXTRA_LEAN


Second, open up your "NaturalResponse.h" file and check to make sure that if you included OpenGL there that Windows comes before it.

This topic is closed to new replies.

Advertisement