Thread: RE: [Dev-C++] problem linking to freeglut
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Damien A <g_...@ho...> - 2004-01-01 21:45:43
|
<html><div style='background-color:'><DIV class=RTE> <P>Include windows.h before including glut.<BR><BR></P></DIV> <DIV></DIV>>From: Chris Dion <CD...@SH...> <DIV></DIV>>To: dev...@li... <DIV></DIV>>Subject: [Dev-C++] problem linking to freeglut <DIV></DIV>>Date: Thu, 01 Jan 2004 13:18:08 -0800 <DIV></DIV>>MIME-Version: 1.0 <DIV></DIV><mailto:dev...@li...?subject=unsubscribe><mailto:dev...@li...><mailto:dev...@li...?subject=help><mailto:dev...@li...?subject=subscribe> <DIV></DIV>>Hello all, <DIV></DIV>> <DIV></DIV>>I tried searching the archive before posting, but sourceforge <DIV></DIV>>doesn't want to cooperate today. I'm having trouble linking to the <DIV></DIV>>freeglut lib that came in the DevPak found here: <DIV></DIV>>http://www.nigels.com/glt/devpak/ using Dev-Cpp 4.9.8.5. <DIV></DIV>> <DIV></DIV>>I had similar problems linking with the glut libs that were included <DIV></DIV>>with this version of Dev-Cpp. Any suggestions? <DIV></DIV>> <DIV></DIV>>Here is a snippet of the compiler output: <DIV></DIV>>g++.exe src/cobject.o src/cstring.o src/main.o src/cmemorystream.o <DIV></DIV>>src/capplication.o src/cwindow.o -o "Core.exe" -L"C:/Dev-Cpp/lib" <DIV></DIV>>-lopengl32 -lfreeglut <DIV></DIV>>src/capplication.o(.text+0xc):capplication.cpp: undefined reference <DIV></DIV>>to `_imp__glutInitDisplayMode@4' <DIV></DIV>>src/capplication.o(.text+0x1e):capplication.cpp: undefined reference <DIV></DIV>>to `_imp__glutIdleFunc@4' <DIV></DIV>>src/capplication.o(.text+0xb8):capplication.cpp: undefined reference <DIV></DIV>>to `_imp__glutDisplayFunc@4' <DIV></DIV>>src/capplication.o(.text+0xca):capplication.cpp: undefined reference <DIV></DIV>>to `_imp__glutReshapeFunc@4' <DIV></DIV>>src/capplication.o(.text+0xdc):capplication.cpp: undefined reference <DIV></DIV>>to `_imp__glutMouseFunc@4' <DIV></DIV>> <DIV></DIV>> <DIV></DIV>> <DIV></DIV>>------------------------------------------------------- <DIV></DIV>>This SF.net email is sponsored by: IBM Linux Tutorials. <DIV></DIV>>Become an expert in LINUX or just sharpen your skills. Sign up for <DIV></DIV>>IBM's <DIV></DIV>>Free Linux Tutorials. Learn everything from the bash shell to sys <DIV></DIV>>admin. <DIV></DIV>>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click <DIV></DIV>>_______________________________________________ <DIV></DIV>>Dev-cpp-users mailing list <DIV></DIV>>Dev...@li... <DIV></DIV>>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm <DIV></DIV>>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users <DIV></DIV></mailto:dev...@li...?subject=subscribe></mailto:dev...@li...?subject=help></mailto:dev...@li...></mailto:dev...@li...?subject=unsubscribe></div><br clear=all><hr>Tired of spam? Get <a href="http://g.msn.com/8HMBEN/2734??PS=">advanced junk mail protection</a> with MSN 8.</html> |
|
From: Damien A <g_...@ho...> - 2004-01-01 22:20:22
|
<html><div style='background-color:'><DIV class=RTE> <P><BR>Ok, I just tested the package. I thought it was similiar to glut, and thats how I solved my linker errors (include windows.h). Anyways, I compiled a sample project without any errors. Only thing is, the template which comes in the devpak uses glut.h instead of freeglut.h. You shouldn't have any problems if your linker settings match those in the sample.<BR></P></DIV> <DIV></DIV>>From: Chris Dion <CD...@SH...> <DIV></DIV>>To: Damien A <G_...@HO...> <DIV></DIV>>CC: dev...@li... <DIV></DIV>>Subject: Re: [Dev-C++] problem linking to freeglut <DIV></DIV>>Date: Thu, 01 Jan 2004 14:03:44 -0800 <DIV></DIV>>MIME-Version: 1.0 <DIV></DIV>>Received: from pd3mo2so.prod.shaw.ca ([24.71.223.10]) by mc12-f32.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 1 Jan 2004 14:01:21 -0800 <DIV></DIV>>Received: from pd3mr2so.prod.shaw.ca (pd3mr2so-ser.prod.shaw.ca [10.0.141.178]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HQT007B2ZTDU1@l-daemon> for g_...@ho...; Thu, 01 Jan 2004 15:00:49 -0700 (MST) <DIV></DIV>>Received: from pn2ml10so.prod.shaw.ca (pn2ml10so-qfe0.prod.shaw.ca [10.0.121.80]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HQT001T8ZTD8Y@l-daemon> for g_...@ho...; Thu, 01 Jan 2004 15:00:49 -0700 (MST) <DIV></DIV>>Received: from shaw.ca (h24-85-228-199.vc.shawcable.net [24.85.228.199]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HQT00535ZTD5P@l-daemon> for g_...@ho...; Thu, 01 Jan 2004 15:00:49 -0700 (MST) <DIV></DIV>>X-Message-Info: JGTYoYF78jF8zQ4ca5omocFBV7tugaka <DIV></DIV>>In-reply-to: <LAW...@HO...> <DIV></DIV>>Message-id: <3FF...@sh...> <DIV></DIV>>X-Accept-Language: en-us, en <DIV></DIV>>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 <DIV></DIV>>References: <LAW...@HO...> <DIV></DIV>>Return-Path: cd...@sh... <DIV></DIV>>X-OriginalArrivalTime: 01 Jan 2004 22:01:21.0795 (UTC) FILETIME=[CA93DD30:01C3D0B2] <DIV></DIV>> <DIV></DIV>>Unfortunately, that didn't help. My application compiles without <DIV></DIV>>error, it's some kind of linking problem. <DIV></DIV>>I'm using freeglut 2.2.0 from http://freeglut.sourceforge.net/. <DIV></DIV>> <DIV></DIV>>Damien A wrote: <DIV></DIV>> <DIV></DIV>>>Include windows.h before including glut. <DIV></DIV>>> <DIV></DIV>>> >From: Chris Dion >To: dev...@li... <DIV></DIV>>> >Subject: [Dev-C++] problem linking to freeglut >Date: Thu, 01 Jan <DIV></DIV>>>2004 13:18:08 -0800 >MIME-Version: 1.0 >Hello all, > >I tried <DIV></DIV>>>searching the archive before posting, but sourceforge >doesn't want <DIV></DIV>>>to cooperate today. I'm having trouble linking to the >freeglut <DIV></DIV>>>lib that came in the DevPak found here: <DIV></DIV>>> >http://www.nigels.com/glt/devpak/ using Dev-Cpp 4.9.8.5. > >I had <DIV></DIV>>>similar problems linking with the glut libs that were included <DIV></DIV>>> >with this version of Dev-Cpp. Any suggestions? > >Here is a <DIV></DIV>>>snippet of the compiler output: >g++.exe src/cobject.o <DIV></DIV>>>src/cstring.o src/main.o src/cmemorystream.o >src/capplication.o <DIV></DIV>>>src/cwindow.o -o "Core.exe" -L"C:/Dev-Cpp/lib" >-lopengl32 <DIV></DIV>>>-lfreeglut >src/capplication.o(.text+0xc):capplication.cpp: <DIV></DIV>>>undefined reference >to `_imp__glutInitDisplayMode@4' <DIV></DIV>>> >src/capplication.o(.text+0x1e):capplication.cpp: undefined <DIV></DIV>>>reference >to `_imp__glutIdleFunc@4' <DIV></DIV>>> >src/capplication.o(.text+0xb8):capplication.cpp: undefined <DIV></DIV>>>reference >to `_imp__glutDisplayFunc@4' <DIV></DIV>>> >src/capplication.o(.text+0xca):capplication.cpp: undefined <DIV></DIV>>>reference >to `_imp__glutReshapeFunc@4' <DIV></DIV>>> >src/capplication.o(.text+0xdc):capplication.cpp: undefined <DIV></DIV>>>reference >to `_imp__glutMouseFunc@4' <DIV></DIV>> <DIV></DIV>> <DIV></DIV></div><br clear=all><hr>STOP MORE SPAM with <a href="http://g.msn.com/8HMBEN/2728??PS=">the new MSN 8</a> and get 2 months FREE*</html> |
|
From: Chris D. <cd...@sh...> - 2004-01-01 22:26:56
|
Hurray! Matching the linker settings to those in the template resolv= ed=20 the linker errors. Thanks for your help Damien and Bal=E1zs. Damien A wrote: > > Ok, I just tested the package. I thought it was similiar to glut, = and=20 > thats how I solved my linker errors (include windows.h). Anyways, = I=20 > compiled a sample project without any errors. Only thing is, the= =20 > template which comes in the devpak uses glut.h instead of freeglut.= h. =20 > You shouldn't have any problems if your linker settings match those= in=20 > the sample. > |
|
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 |
|
From: Chris D. <cd...@sh...> - 2004-01-01 22:00:51
|
Unfortunately, that didn't help. My application compiles without error, it's some kind of linking problem. I'm using freeglut 2.2.0 from http://freeglut.sourceforge.net/. Damien A wrote: > Include windows.h before including glut. > > >From: Chris Dion >To: dev...@li... >Subject: > [Dev-C++] problem linking to freeglut >Date: Thu, 01 Jan 2004 13:18:08 > -0800 >MIME-Version: 1.0 >Hello all, > >I tried searching the archive > before posting, but sourceforge >doesn't want to cooperate today. I'm > having trouble linking to the >freeglut lib that came in the DevPak > found here: >http://www.nigels.com/glt/devpak/ using Dev-Cpp 4.9.8.5. > > >I had similar problems linking with the glut libs that were > included >with this version of Dev-Cpp. Any suggestions? > >Here is a > snippet of the compiler output: >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' |