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: cygwin with opengl


James,

Thanks for such an informative and detailed response.
It turns out to be a FAQ for our OpenGL students
who like to compile on Linux and Cygwin.

http://goanna.cs.rmit.edu.au/~gl/teaching/cs549/index.html

Do you mind if I recycle your posting?

And yes, we hit the same "but why doesn't gcc just _know_
what I want, like MSVC _seems_ to..." mentality...

Cheers,

Nigel

James Shaw wrote:

Hi Samuel,

I posted a short reply to the list yesterday,
which I'm guessing you didn't see. Since you're
asking again, I'll use this opportunity to give a
longer answer. [Note though that if you don't
regularly check the list, please explicitly ask to
be cc'ed.]

You had two postings. The most recent said:

I cannot compile a file.c where there is the

following

include : > GL\glut.h GL\glu.h GL\gl.h

The first posting was more informative and said:

I have tried with : gcc -o file -Wall -lglut -lGL

-lGLU file.c

but I recieved the following message :
/usr/lib/gcc-lib/i686-pc-cygwin/3.2/

../../../../i686-

pc-cygwin/bin/ld : cannot find -lGLU
/usr/lib/gcc-lib/i686-pc-cygwin/3.2/

../../../../i686-

pc-cygwin/bin/ld : cannot find -lGL

So, it looks like your include path is ok, since
you only got errors at the linker stage.


I'm sure I have installed the file opengl....tar.bz2

You probably have, but let's check to make sure.
You should ls /usr/include/GL and find the .h
files that you include there. Next, you should ls
/usr/lib. Unfortunately, as far as I see, my gl
libraries aren't in /usr/lib, but are lower down
in /usr/lib/w32api. So, check if you have the
following files there: libopengl32.a libglu32.a
libglut32.a

Assuming you do, you then have the OpenGL
developers stuff, as far as I know.


Can you propose me some technics to reslove my

problem :

-compile? I use : -lglut -lGLU -lGL -lopengl
-configure some path???
-set up the libraries???

Ok, I'll give you the exact command line I use, for
one file:
gcc hellogl.cpp -o hellogl -lglut32 -lglu32
-lopengl32

Note that glut comes first, followed by glu and
opengl. Also, note that their names aren't gl,
glu and glut (as one might expect) but opengl32,
glu32, glut32. This matches the libraries in
your /usr/lib/w32api directory. In general, unix
libraries of the name lib<name>.a, are included
with a -lname. I'm guessing your main problem
was that there are no files with the names:
libglu.a or libgl.a hence your errors claiming no
-lGL or -lGLU. [Oddly enough, there is a
libglut.a, but I don't know how it differs from
libglut32.a, and I haven't tried it. I've ignored
it, and suggest you do too.]

Now, I assume the above will work, but I'll have
to admit, I'm not quite sure how gcc knows to look
in w32api, so if you have problems, try adding:
-L/usr/lib/w32api
or explicitly list the libraries you want to link:
/usr/lib/w32api/libglut32.a
/usr/lib/w32api/libglu32.a
/usr/lib/w32api/libopengl32.a


Thanks to help me because I have to do my opengl
homework for few days!!!

I think with the correct library names you'll be
up and running. This isn't gl related, but if you
are planning on using cygwin and gcc, you may want
to spend a little time and research into
understanding how the compiler works (e.g. so
you'd know to look in /usr/lib; that you are both
compiling and linking in one step, etc.).

Best of luck on your homework,
James Shaw



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]