Building OpenGL from source

Carlo Florendo list-subscriber@hq.astra.ph
Wed Jun 8 03:32:00 GMT 2005


Zieg, Mark wrote:

>However, trying to link against those spat out lots of undefined
>references:
>
>  make[1]: Entering directory `/home/ziegm/opengl/teapot'
>  g++ teapot.o -L/usr/X11R6/lib -lglut -lGLU -lGL -o teapot
>  teapot.o:teapot.cpp:(.text+0xd2): undefined reference to
>`_glClearColor@16'
>  teapot.o:teapot.cpp:(.text+0xe1): undefined reference to
>`_glShadeModel@4'
>  teapot.o:teapot.cpp:(.text+0x11d): undefined reference to
>`_glMaterialfv@12'
>  teapot.o:teapot.cpp:(.text+0x159): undefined reference to
>`_glLightfv@12'
>  teapot.o:teapot.cpp:(.text+0x1fe): undefined reference to
>`_glEnable@4'
>  teapot.o:teapot.cpp:(.text+0x27c): undefined reference to
>`_gluLookAt@72'
>  ...etc
>
>  
>

You don't need X11 to compile the app on cygwin, unless the app was 
written for X11, in which case, you really have to link against the X11 
libraries.


I guess that you need to link correctly with the w32api libraries.  Try 
these out:


g++ teapot.o  /lib/w32api/libopengl32.a  /lib/w32api/libglu32.a \
    /lib/w32api/libgdi32.a  -lm -o teapot


If you want the binary to be native windows (i.e. does not depend on 
cygwin), you may want to try adding the -mno-cygwin option on your 
invocation to g++.

HTH.

Best Regards,

Carlo

-- 
Carlo Florendo
Astra Philippines Inc.
www.astra.ph



More information about the Cygwin-xfree mailing list