undefined reference...

Dear OpenGL-developers,

When compiling a C-program, using GLUT, I get errors like "undefined reference to ‘_imp__glClearColor’ and so on. My command is “gcc -o test1.exe -L"C:\Dev-Cpp\bin” -lglu32 -lglut32 -lopengl32 test1.c

I’ve placed the GLUT .h-File in the include\GL-directory, the GLUT .dll in Windows\System and the GLUT .lib-file in \lib.

Maybe some parameter is missing in the compile-statement, but I don’t know which one.

Thanks a lot in advance.
Best regards,

Well, maybe I should give some more details:

“glut32.dll” is in the directory c:\Windows\System32 and in c:\Dev-Cpp\bin.

“glut.h” is in c:\Dev-Cpp\include\GL.

“glut32.lib” is in c:\Dev-Cpp\lib.

In my .c-File I just say “#include <GL/glut.h>” - however, in the c-File there shouldn’t be any errors.

When using the compile-statement mentioned above, I get the “undefined reference imp_*”-errors (without saying “-L"C:\Dev-Cpp\bin” -lglu32, -lglut32 and -lopengl32" I get far more undefined references, which is pretty clear :wink: )

It would be really great if someone could help me out here, because I’m quite stuck.


I had the same problem with glut when I was using gcc. I don’t remember the whole solution because it’s a few of years, but it was somehow caused also by glut version. Try to google it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.