Cygwin gcc with openGL

Started by
6 comments, last by IceCoolEll 19 years, 10 months ago
Hi i''ve been trying desperately to setup my family''s home windows98 PC to do some openGL programming. I downloaded the latest version of cygwin and installed the gcc C and C++ compiler that came with it. Normal Hellow World-type programs compile fine but openGL clearly isnt installed correctly. I have since followed the instructions for GLUT with cygwin as found here: http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne/cygwin/opengl_glut.html but these seem to be for an old version of cygwin (B20.1) and after following all these instructions I still get a bunch of errors at compile time using the command: gcc cube.c -lglut32 -lglu32 -lopengl32 -o cube where cube.c is the redbook example program to draw a wire cube with an added line #include <windows.h> from the suggestion of the above web page. Does anyone have an updated solution to compiling openGL in cygwin gcc? the openGL page suggests all you need are the headers (.h) libraries (.lib) and extensions (.dll) in the right place, but even with successfully converted libraries (.a) i still cant compile. I''m stuck.
Advertisement
Change it to:

gcc Test.cpp -o test -lopengl32 -lglu32 -lglut32

Order of flags/options important
Also you shouldn''t need to include windows.h file for a glut app
Thanks for your response but even with that odering of flags i still get the same errors.. there are only a few so here they are:

/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x1c):cube.c: undefined reference to `___glutInitWithExit@12''
/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x3c):cube.c: undefined reference to `___glutCreateWindowWithExit@8''
/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x5c):cube.c: undefined reference to `___glutCreateMenuWithExit@8''
/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x12e):cube.c: undefined reference to `_gluLookAt@72''
/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x15d):cube.c: undefined reference to `_glutWireCube@8''
/cygdrive/c/WINDOWS/TEMP/ccPzVsjt.o(.text+0x1fb):cube.c: undefined reference to `_glFrustum@48''
collect2: ld returned 1 exit status

Note that if i do take the #include <windows.h> line out there are about 400 syntax errors relating to my gl.h and glu.h files

ThanksInAdvance
When you setup Cygwin, did you choose to download opengl package for it aswell? it works fine for me.

If not you can re-run the cygwin setup program and download extra packages to install

[edited by - snk_kid on June 6, 2004 10:33:00 AM]
yes i had the openGL package installed. I think I may have altered my windows 98 readiness for openGL somehow. I did manage to compile the cube program at one point but I must have altered something. Is there anything I can do to avoid reinstalling windows completely?

perhaps you could list/send me the files relating to opengl in your cygwin folder under the usr/include/GL directory, the \lib\w32api directory and the windows/system folder. would that work?

again thanks.
Sorry should have asked, did you also install the latest version of w32api i think its 2.5.

There should be at least these following headers:

glut.h
gl.h
glu.h


And these static libaries:

libglut32.a
libopengl32.a
libglu32.a

There also multiple versions of these on cygwin for using with X instead of win32 and also MinGW versions aswell, so i don''t know which is the directory is the wright one to tell you.

Why don''t just uninstall cygwin, delete the whole cygwin folder, use regedit to delete the registry keys and do fresh install of that.
Thanks i uninstalled, deleted registry keys in KKEY_CURRENT_USER/Software and HKEY_LOCAL_MACHINE/Software. Then i reinstalled making sure w32api and the openGL libraries were checked. Finally I included the #include <windows.h> before #include <GL/glut.h> and compiled using the suggested:

gcc foo.c -o foo -lopengl32 -lglu32 -lglut32

Just incase anyone else has this problem that is.

Thanks for all your help that was driving me crazy.
Now off to develop some fps action!

This topic is closed to new replies.

Advertisement