Jump to content
  • Advertisement
Sign in to follow this  
methe

g++ and glext.h

This topic is 4430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 *);

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!