Re: [Dev-C++] problem linking to freeglut
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <or...@vp...> - 2004-01-02 00:05:17
|
Chris Dion wrote: > Hurray! Matching the linker settings to those in the template resolved > the linker errors. Thanks for your help Damien and Balázs. A bit of explanation of the error. The linker spitted this (what you posted): g++.exe src/cobject.o src/cstring.o src/main.o src/cmemorystream.o src/capplication.o src/cwindow.o -o "Core.exe" -L"C:/Dev-Cpp/lib" -lopengl32 -lfreeglut src/capplication.o(.text+0xc):capplication.cpp: undefined reference to `_imp__glutInitDisplayMode@4' src/capplication.o(.text+0x1e):capplication.cpp: undefined reference to `_imp__glutIdleFunc@4' src/capplication.o(.text+0xb8):capplication.cpp: undefined reference to `_imp__glutDisplayFunc@4' src/capplication.o(.text+0xca):capplication.cpp: undefined reference to `_imp__glutReshapeFunc@4' src/capplication.o(.text+0xdc):capplication.cpp: undefined reference to `_imp__glutMouseFunc@4' As you see, the linker cannot find symbols like "_imp__glutMouseFunc@4" etc. However, you might wonder why, as glutMouseFunc IS defined in the freeglut headers. But if you take a closer look, it is prefixed with "_imp_" which marks, that the linker is looking for an imported function, that is: a function, which is inside a DLL. And this happens because the compiler compiled your program without the define I wrote (-DFREEGLUT_STATIC), and by default, the headers of freeglut set up things to use the dynamic build of freeglut (FREEGLUT_DYNAMIC is the default). So when you linked your program, the linker looked for imported functions, however the freeglut devpak contains a static build, and a static library's functions don't contain "_imp_" decorations. The linker saw the two as totally different symbols. I hope that helps a bit to see the works in behind. -- Greetings, Balázs |