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: Header problem with OGL on Cygwin


Paul M Sargent <Pauls at 3dlabs dot com> wrote:


Hi All,

I'm currently having some problems linking with OpenGL under cygwin. I was
hoping somebody who understands the system might be able to offer some
advice.

The problem I'm having is that when I try to link my object files together
with "-lglut32 -lglu32 -lopengl32" I get messages stating that there are
"undefined reference"(s) to "_glBegin", amonst other symbols.

Searching through the archives I've spotted a message stating that this
means I'm compiling with the wrong headers (The symbols should be of the
form _glBegin at 4'). It's at this point that I've lost the thread. My code
contains "#include <GL/glut.h>" and doing a 'find / -name glut.h' only shows
the one file located in /usr/include/GL.  Similarly doing the same find for
gl.h gives me one in /usr/include/GL and one in /usr/include/w32api/GL.

My compile command is "gcc -c <source file>"
My link    command is "gcc -o <exe name> <object files> -lglut32 -lglu32
-lopengl32"

Am I missing something simple?

Thanks for any help you can provide

Paul

Paul,


In the past, 99% of the time such problem occured, people were _not_ linking with arguments in the appropriate order.

-lglut32 -lglu32 -lopengl32

must come after all objects on the command line.

Please try compiling and linking this test program; copy the following lines to helloGlut.c :

/*-------------------------- helloGlut.c start ----------------------------*/
#include <GL/glut.h>

void display_func()
{
glClear(GL_COLOR_BUFFER_BIT);
}

int main()
{
glutCreateWindow("Hello GLUT!");
glutDisplayFunc(display_func);
glutMainLoop();
return 0;
}
/*-------------------------- helloGlut.c end------------------------------*/

And compile and link with _the exact_ following lines:
gcc -c helloGlut.c
gcc -o helloGlut helloGlut.o -lglut32 -lglu32 -lopengl32

If you get any error messages, report them here verbatim and we'll work from there. Also send the ouput of "cygcheck -c" to a file and attach it to your email.



André Bleau, Cygwin's OpenGL package maintainer.

email: bleau at igb dot umontreal dot ca
(Fight SPAM: encode your email-address)

Please address all questions and problem reports about Cygwin's OpenGL package to cygwin at cygwin dot 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/


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