Sign in to follow this  
aviosity

Eclipse CDT, Cygwin, and OpenGL Woes

Recommended Posts

This is a pretty complex setup problem, so any help anybody can give me would be most appreciated. I have an installation of Windows XP Pro SP1. I'm using Cygwin 1.5.18-1, with the gcc compiler, gdb debugger, and make utilities installed (the Eclipse CDT requires this to work, since it doesn't include a compiler, debugger, or build program). I've installed Eclipse IDE 3.1.1 on top of the Java 1.5 SDK, and downloaded/installed the CDT version 3.0 (both SDK and Tools SDK) from the CDT update site. I was rather gung-ho about getting started in OpenGL using these tools and my OpenGL Superbible, but alas, this was not to be. I trudged through website after website trying to figure out how to set up the header files, DLLs, and libraries for use with Cygwin and Eclipse CDT. Here's what I ended up with. Under C:\WINDOWS\system32 I have: opengl32.dll, version 5.1.2600.1106 by MS, last modded 3/31/2003. glu32.dll, version 5.1.2600.0 by MS, last modded 3/31/2003. glut32.dll, version unavailable, last modded 11/8/2001. Under C:\cygwin\usr\include I have: fgl.h (from OpenGL Superbible (OGLSB)) fglu.h (from OGLSB) glut.h GLEXT.h WGLEXT.h OpenGL.h (from OGLSB, a file that determines OS and then does proper includes from the C:\cygwin\usr\include and C:\cygwin\usr\include\gl folders, contents described below) Under C:\cygwin\usr\include\gl, I have: GLTools.h gl.h glu.h GLAUX.h Under C:\cygwin\usr\lib, I have: opengl32.lib glaux.lib glu32.lib glut32.lib Okay, so here comes the big problem. When in Eclipse, I include the OpenGL.h header file, which is recognized. The OpenGL.h header file itself recognizes a Windows system running Visual C++, and includes windows.h, gl/gl.h, gl/glu.h, glut.h, glext.h, and wglext.h. I understand I'm running Cygwin with gcc, but all these includes (save windows.h) exist. Here's the program I'm trying to create: #include<OpenGL.h> void RenderScene(void) { glClear(GL_COLOR_BUFFER_BIT); glFlush(); } void SetupRC(void) { glClearColor(0.0f,0.0f,1.0f,1.0f); } void main(void) { glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutCreateWindow("Simple"); glutDisplayFunc(RenderScene); SetupRC(); glutMainLoop(); } This program throws warnings on every glXXX call, stating that the functions are implicitly declared, but the real problem is with the constants GL_COLOR_BUFFER_BIT, GLUT_SINGLE, and GLUT_RGB. Eclipse says that the constants are undeclared, but they should be included with the includes in the OpenGL.h file. If anybody has any idea what's going on here, I'd be most appreciative...I've used Eclipse with Java plenty of times before and am now using C (which I'm moderately familiar with). I've never setup Cygwin or Eclipse before for use with C, let alone OpenGL. Thanks so much, and sorry for the long post :P Thanks, Aviosity

Share this post


Link to post
Share on other sites
Quote:
OpenGL.h (from OGLSB, a file that determines OS and then does proper includes from the C:\cygwin\usr\include and C:\cygwin\usr\include\gl folders, contents described below)


I think this is the key right here. My guess is that it's unable to determine you're current setup, so doesn't include anything. Thus, none of your OpenGL functions and #defines are included. Take a look in the header and see if you can manually #define something to force it to choose a particular setup (that matches yours, obviously).

EDIT: Just noticed this:
Quote:
The OpenGL.h header file itself recognizes a Windows system running Visual C++, and includes windows.h, gl/gl.h, gl/glu.h, glut.h, glext.h, and wglext.h


Are you sure about this? It shouldn't be picking up GCC as Visual C++. If it was trying to include these files and couldn't find them it would spit out an error to that effect, insert some code just before where 'gl.h' is included that would generate an error and see if that error happens. If you are sure, try manually #undef'ing __GL_H__ and __gl_h__ just before including 'gl.h', these are used as include guards in gl.h (in VS2003 anyway, check your header files to be sure).

Share this post


Link to post
Share on other sites
Thanks for your quick reply, joanusdmentia :)

I tried excluding the OpenGL.h header altogether and just including gl/gl.h and glut.h in the actual file. What ended up being the problem was the windows.h include; I stupidly didn't even think that cygwin's port of gcc didn't have the windows header files, which glut needs to create windows, handle WinMain, etc. I found out that my school had versions of Visual Studio Pro 6.0 on the web, downloaded and installed it, and now my code is working fine and I'm well on my way. Thanks so much; I'll definitely be sticking around here :)

Thanks,
Aviosity

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