Sign in to follow this  
tebriel

OpenGL SDL/Opengl/MSVC6 compile problems...

Recommended Posts

Something as simple as this shouldn't be causing me a problem, but I'm just about out of ideas here. Maybe someone here can point out a stupid mistake I'm not seeing. I'm trying to compile an open source project called Crown and Cutlass. http://sourceforge.net/projects/crownandcutlass/ I'm using MSVC6, and I've followed the quite simple SDL install instructions. I'm getting errors like this when I compile: c:\projects\crown\extensions.h(28) : error C2146: syntax error : missing ';' before identifier 'glMultiTexCoord2f' c:\projects\crown\extensions.h(28) : fatal error C1004: unexpected end of file found This long thing in caps is what's confusing the compiler obviously: PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f = 0; For some reason, these typedefs aren't being loaded, even though I believe I've followed the SDL and project's install instructions correctly. If I comment that line out, the next GL typedef causes the same error. I've even tried literally copying the typedef line needed from glext.h, ex. (Which is really an unacceptable answer anyway, but fine for troubleshooting purposes.) typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); If I do this for every line I have a problem with, I still get linker errors. (Even though I am linking to everything I'm supposed to: opengl32.lib glu32.lib SDLmain.lib SDL.lib SDL_image.lib.) I have added NO_SDL_GLEXT (which I don't quite get the point of since we're including glext.h anyway) as a preprocessor definition of course--still doesn't help. I'm not new to programming, but I could be called an OpenGL extensions noob--what the heck am I missing here? I've been doing this stuff for years but this one has me stumped at the moment! (Nothing like troubleshooting preprocessor "logic"! :p ) Anyone have any ideas? I'll paste the entire "problem" header below.
/* David Thulson
 * Crown and Cutlass
 * OpenGL Extensions Handling Header
 */

#if !defined ( _EXTENSIONS_H_ )
#define _EXTENSIONS_H_

#if defined (WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

#include "SDL_opengl.h"


#ifndef WIN32
#define GL_GLEXT_PROTOTYPES
#endif
#include <GL/glext.h>


#if defined (WIN32)


// Multitexturing functions
// Note: these are actually declared in extensions.cpp
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f;
extern PFNGLACTIVETEXTUREARBPROC glActiveTexture;
extern PFNGLACTIVETEXTUREARBPROC glClientActiveTexture;

// For VAs and VBOs
extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;

// VBO Extension Function Pointers
extern PFNGLGENBUFFERSARBPROC glGenBuffers;
extern PFNGLBINDBUFFERARBPROC glBindBuffer;
extern PFNGLBUFFERDATAARBPROC glBufferData;
extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffers;

#endif

void initExtensions();

bool checkExtension(const char *str);

#endif


Share this post


Link to post
Share on other sites
This is David Thulson, the project admin for Crown and Cutlass. Collin, the developer who works in MSVC6, responded in the thread on our project forums. Not that that means no one should answer here, just thought I should make a note of it.

FYI, the NO_SDL_GLEXT macro tells SDL not to include it's own version of the extensions header, so while we don't check for it in our code, it's still useful. Here's a quote from the comment that starts on line 51 of SDL_opengl.h:

/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials.
It is included here because glext.h is not available on some systems.
If you don't want this version included, simply define "NO_SDL_GLEXT"
*/



I tried using SDL's extension stuff for a bit, but it only gave me trouble. It would probably have worked eventually, but we just decided to stick with what we had. Anyway, that's what that define does. Try Collin's advice and keep us posted. Even if your problem gets solved here, could you post your final status/solution in the sourceforge project thread? That way we get the solution as well as the problem in our forum, so if other people have the same trouble they can find the answer easier. Thanks.

Share this post


Link to post
Share on other sites
Thanks man, turns out that an outdated header WAS the problem, although not one of the headers we were thinking about.

An outdated glu.h was the problem it appears, which based on what it says it does makes perfect sense.

That's the good news... the bad news is, I happened to find the "updated" file on my system and not on some website, so I have NO idea where anyone else would find it if they have the same issues...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this