openGL with gcc

I get these errors when I try: gcc test.c -lopengl32 -lglu32:

D:\prog>gcc newgl.c -lopengl32 -lglu32
C:\TEMP\cc0001681.o(.text+0xd9):newgl.c: undefined reference to glutInit@8' C:\TEMP\cc0001681.o(.text+0xe0):newgl.c: undefined reference toglutInitDisplay
C:\TEMP\cc0001681.o(.text+0xef):newgl.c: undefined reference to glutInitWindowS ize@8' C:\TEMP\cc0001681.o(.text+0xf9):newgl.c: undefined reference toglutCreateWindo
C:\TEMP\cc0001681.o(.text+0x108):newgl.c: undefined reference to glutDisplayFun c@4' C:\TEMP\cc0001681.o(.text+0x10d):newgl.c: undefined reference toglutMainLoop@0

I’m using gcc on nt. Thanks if anyone knows what I have done wrong here.

Sorry, of course the name of the file is “newgl.c”

you also need to link in the glut library.
gcc … -lglut32 should do it.

After that, since you are on NT, the compiler will propably complain other missing symblos related to windows dlls. Use gcc -mwindows to have the standard libs linked in and add -mno-cygwin to get your app running outside the cygwin environment.