HELP: I can't get passed step1!


I’m getting link errors.
I’m running cygwin, downloaded a few days ago, so it’s gcc 3.2.3

Source Code: prog.C
#include <GL/glut.h>
int main(int argc, char** argv)
glutInit (&argc, argv) ;

return 0 ;

compiled with:
gcc -lglui -L/lib/w32api -o prog.exe prog.C

Temp/ccCh0KDT.o(.text+0x2c) :prog.C: undefined reference to `_glutInit@8’

I have confirmed that the string “_glutInit@8” appears in /lib/w32api/libglui.a

So why does the Linking fail???


[This message has been edited by The_Dj (edited 06-06-2003).]

i would have compiled with something like
g++ prog.C -o exe -L/lib/w32api -lglui prog.exe

instead of:
gcc -lglui -L/lib/w32api -o prog.exe prog.C

it just looks like your compile fields are mixed up. learning how to use gmake by creating a Makefile may help you remember compiling rules.

hope this helps,

Thanks for the reply, but:

swapping the order of the parameters has made no difference.

I normally do use a Makefile, but I didn’t want to complicate the question.


i should know my compile rules!

g++ code.C -o name.exe -L{libPath} -l{libName}

nothing should come after the library name.

Yeah, I figured that. :stuck_out_tongue:

and now for the obvious solution:

don’t link glui ! link glut!

path = {?}
name = -lglut

sorry i missed it.

Linking glu32 solved that.

But now I’m getting others as I add more code.

I’ll look into what extras I need for them before posting here again.

Thanks for the help.

Yup. Working.

Odd, this, I tried linking to most libraries that seemed right, including these.

I think my final solution was changing the order of switches in my Makefile as well as choosing the right libs.

Live & learn.

glut is the lib you actually need.

if you don’t have it already (not a standard lib) then search with google for it and you will probably find Nate Robbins name attached. he should have any win32 libs precompiled with a readme about how to install. i don’t know if the rules will apply with cygwin, but to make things easy, put any libs where your glui lib is and use the same path. you may need to do the same with the glut’s header file.