OpenGL and Cygwin

suresh@research.att.com suresh@research.att.com
Wed Oct 22 06:51:00 GMT 2003


As per Andre's suggestion, i compiled and ran the attached program. Below 
are the outputs under different system settings:

All programs run from tcsh inside cygwin. My LD_LIBRARY_PATH also had my 
current dir, because I had the nvidia glut32.dll and glut32.lib files in 
it (which work when compiled with visual C++ on a different machine - I 
tried one of their demos)

This was the first run, just from scratch with no extra parameters.

----------------------------------------------------------------------
[Root@euclid ~/src]$ g++ -o helloglut opengltest.c -lglut32 -lglu32 -
lopengl32
/tmp/ccwy9vdk.o(.text+0xe):opengltest.c: undefined reference to `_glClear'
/tmp/ccwy9vdk.o(.text+0x4c):opengltest.c: undefined reference to 
`_glutInit'
/tmp/ccwy9vdk.o(.text+0x58):opengltest.c: undefined reference to 
`_glutCreateWin
dow'
/tmp/ccwy9vdk.o(.text+0x64):opengltest.c: undefined reference to 
`_glutDisplayFu
nc'
/tmp/ccwy9vdk.o(.text+0x69):opengltest.c: undefined reference to 
`_glutMainLoop'

collect2: ld returned 1 exit status
---------------------------------------------------------------------

To account for the vagaries of LD_LIBRARY_PATH, I then tried explicitly 
giving the desired paths for the lib files:

----------------------------------------------------------------
[Root@euclid ~/src]$ g++ -o helloglut opengltest.c -L/usr/lib/w32api -
lglut32 -lglu32 -lopengl32
/tmp/cc5Cu8ni.o(.text+0xe):opengltest.c: undefined reference to `_glClear'
/tmp/cc5Cu8ni.o(.text+0x4c):opengltest.c: undefined reference to 
`_glutInit'
/tmp/cc5Cu8ni.o(.text+0x58):opengltest.c: undefined reference to 
`_glutCreateWin
dow'
/tmp/cc5Cu8ni.o(.text+0x64):opengltest.c: undefined reference to 
`_glutDisplayFu
nc'
/tmp/cc5Cu8ni.o(.text+0x69):opengltest.c: undefined reference to 
`_glutMainLoop'

collect2: ld returned 1 exit status

----------------------------------------------------------------------

I also then tried compiling with =mno-cygwin

-----------------------------------------------------------------
[Root@euclid ~/src]$ g++ -mno-cygwin -o helloglut opengltest.c -lglut32 -
lglu32
-lopengl32
/tmp/cceShHmg.o(.text+0xe):opengltest.c: undefined reference to 
`__imp__glClear'

/tmp/cceShHmg.o(.text+0x4e):opengltest.c: undefined reference to 
`_glutInit'
/tmp/cceShHmg.o(.text+0x5a):opengltest.c: undefined reference to 
`_glutCreateWin
dow'
/tmp/cceShHmg.o(.text+0x66):opengltest.c: undefined reference to 
`_glutDisplayFu
nc'
/tmp/cceShHmg.o(.text+0x6b):opengltest.c: undefined reference to 
`_glutMainLoop'

collect2: ld returned 1 exit status

------------------------------------------------------------------

The only difference in this case was the different library call for 
glClear. I also tried linking the /usr/X11R6/lib opengl libraries using  -
lGL. that cf course got rid of the glClear undefined reference but didn't 
solve the glut problem.




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list