🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

g++ and glext.h

Started by
3 comments, last by methe 17 years, 12 months ago
Hello, I have a funky problem to my eyes. A file is compiling perfect if I use gcc (gcc simpleFBO.c -o lGL -lGLU -lglut) and not at all if I use g++. The given error is: omilla@d5201:~/SVN/GFX/branches/omilla/playground> make g++ simpleFBO.c -o simpleFBO simpleFBO.c: In function ‘void render_redirect()’: simpleFBO.c:124: error: ‘glBindFramebufferEXT’ was not declared in this scope simpleFBO.c: In function ‘int main(int, char**)’: simpleFBO.c:176: error: ‘glGenFramebuffersEXT’ was not declared in this scope simpleFBO.c:182: error: ‘glBindFramebufferEXT’ was not declared in this scope simpleFBO.c:193: error: ‘glFramebufferTexture2DEXT’ was not declared in this scope simpleFBO.c:197: error: ‘glCheckFramebufferStatusEXT’ was not declared in this scope make: *** [simpleFBO] Error 1 I am running a Linux Suse 10 and here are version of compil tools: omilla@d5201:~/SVN/GFX/branches/omilla/playground> gcc -v Using built-in specs. Target: i586-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=i586-suse-linux Thread model: posix gcc version 4.0.2 20050901 (prerelease) (SUSE Linux) omilla@d5201:~/SVN/GFX/branches/omilla/playground> g++ -v Using built-in specs. Target: i586-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=i586-suse-linux Thread model: posix gcc version 4.0.2 20050901 (prerelease) (SUSE Linux) I tried changing header inclusion order, took a look at glext.h (where the incriminated funcs are declared) but couldn't find the solution. any idea?
"A man does what he does because he sees the world as he sees it." A.K
Advertisement
If you're using the glext.h included in the distro, it may be that it doesn't have FBO defined. Did you really checked out this or written it just for reference?

Previously "Krohm"

yes I did check (see below). And moreover it DOES work when using gcc so I guess the distro has the recquired stuffs. I even changed graphics cards to have one that supports these extensions.

omilla@d5201:~/SVN/GFX/branches/omilla/playground> grep Framebuffer /usr/include/GL/*
/usr/include/GL/glext.h:GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *);
/usr/include/GL/glext.h:GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *);
/usr/include/GL/glext.h:GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum);
/usr/include/GL/glext.h:GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint);
/usr/include/GL/glext.h:GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *);
"A man does what he does because he sees the world as he sees it." A.K
Quote: Original post by methe
yes I did check (see below). And moreover it DOES work when using gcc

Sorry, I didn't take this in consideration. It seems like g++ puts those identifiers in a different scope. Namespaces as far as I know are not C-compatible so they shouldn't be a problem (but meybe they're supported as GNU extensions in GCC, who knows).

Although it should not be a difference, try embedding the include in extern "C" { #include... }.

What other libraries are you using? Which ones are included before? Which after?
Are there other extensions which do work? Other funcs? Tokens?
While I think at it, did you #define GL_GLEXT_PROTOTYPES ?

Previously "Krohm"

Quote:
Although it should not be a difference, try embedding the include in extern "C" { #include... }.

The header is already completely in an extern "C":
omilla@d5201:~/SVN/GFX/branches/omilla/playground> grep -n "extern" /usr/include/GL/glext.h
5:extern "C" {

Hey, just found the answer: http://oss.sgi.com/projects/ogl-sample/ABI/
so I should just add #define GL_GLEXT_PROTOTYPES before including glext.h. O_o crazy.

"A man does what he does because he sees the world as he sees it." A.K

This topic is closed to new replies.

Advertisement