This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenGL and Cygwin


suresh at research dot att dot com wrote:

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)

Forget about LD_LIBRARY_PATH; it is not used by cygwin.



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
---------------------------------------------------------------------

The error messages above make it clear: you are using the wrong headers. Cygwin's OpenGL headers would have generated messages like:


$ g++ helloGlut.c -o helloGlut
/cygdrive/c/DOCUME~1/bleau/LOCALS~1/Temp/cc99dyy4.o(.text+0xe):helloGlut.c: unde
fined reference to `_glClear@4'
/cygdrive/c/DOCUME~1/bleau/LOCALS~1/Temp/cc99dyy4.o(.text+0x50):helloGlut.c: und
efined reference to `_glutInit@8'
/cygdrive/c/DOCUME~1/bleau/LOCALS~1/Temp/cc99dyy4.o(.text+0x5f):helloGlut.c: und
efined reference to `_glutCreateWindow@4'
/cygdrive/c/DOCUME~1/bleau/LOCALS~1/Temp/cc99dyy4.o(.text+0x6e):helloGlut.c: und
efined reference to `_glutDisplayFunc@4'
/cygdrive/c/DOCUME~1/bleau/LOCALS~1/Temp/cc99dyy4.o(.text+0x76):helloGlut.c: und
efined reference to `_glutMainLoop@0'
collect2: ld returned 1 exit status


Notice the @4, @8, and @0 after the names.

You said in a previous message that you downloaded headers from NVDIA's site. If you are using these, that's the source of the problem. They are incompatible with gcc and g++ because they do not specify the right calling convention.

My advice: ditch those headers and use the ones from Cygwin's OpenGL package, or the ones from Cygwin's w32api package.

Alternative: modify NVDIA's headers to specify the right calling convention by adding

__attribute__ ((__stdcall__))

to the declaration of the functions. However, if you choose that path, do not expect anymore help from me; I am not going to support people who replace headers from Cygwin packages with headers from third parties. You would have to go to NVDIA's site for support.



André Bleau, Cygwin's OpenGL package maintainer.

Please address all questions and problem reports about Cygwin's OpenGL package to cygwin@cygwin.com .


-- 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]