Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem compiling with devIL ( image loading) libraries and header files

44 views
Skip to first unread message

bilsch

unread,
Apr 22, 2015, 7:13:44 AM4/22/15
to
Error messages are listed below. My OS is Linux Ubuntu 14.04. An OpenGL
tutorial lesson requires installing devIL image loading libraries and
headers I have just updated these libraries located in /usr/lib/i386-
linux-gnu/ and header files located in /usr/include/. These are the usual
locations where linker looks for these kinds of files. I'm getting
'undefined reference' errors for a lot of names associated with devIL.
The tutorial says make sure that the linker can find the libraries. Well
it seems like it isn't finding something it needs. Also, the tutorial
says I need to link against devIL and ilu. Those names are not uniquely
associated with specific files. I tried linking with -ldevIL and -lilu
flags but the linker doesn't recognize those. The problem began with the
introduction of devIL (no pun intended). I'm thinking I need to add
something to an environment variable associated with g++ linker. But I
looked in the environment and I don't recognize anything associated with
running g++ (or gcc for that matter). Though I ran g++ my knowledge is
not at C++ level. I write my own OpenGL programs using C and gcc. So far
I muddle through with limited C++ knowledge.
TIA. Bill S.

/tmp/ccahLqPY.o: In function `initGL()':
LUtil.cpp:(.text+0xe3): undefined reference to `ilInit'
LUtil.cpp:(.text+0x10b): undefined reference to `ilClearColour'
LUtil.cpp:(.text+0x110): undefined reference to `ilGetError'
LUtil.cpp:(.text+0x124): undefined reference to `iluErrorString'
/tmp/cceC2IEh.o: In function `LTexture::loadTextureFromFile(std::string)':
LTexture.cpp:(.text+0x58): undefined reference to `ilGenImages'
LTexture.cpp:(.text+0x63): undefined reference to `ilBindImage'
LTexture.cpp:(.text+0x76): undefined reference to `ilLoadImage'
LTexture.cpp:(.text+0x93): undefined reference to `ilConvertImage'
LTexture.cpp:(.text+0xa8): undefined reference to `ilGetInteger'
LTexture.cpp:(.text+0xb6): undefined reference to `ilGetInteger'
LTexture.cpp:(.text+0xbd): undefined reference to `ilGetData'
LTexture.cpp:(.text+0xea): undefined reference to `ilDeleteImages'

Louis Krupp

unread,
Apr 22, 2015, 11:00:25 AM4/22/15
to
On Wed, 22 Apr 2015 11:12:33 +0000 (UTC), bilsch <kin...@comcast.net>
wrote:

<snip>

>I tried linking with -ldevIL and -lilu
>flags but the linker doesn't recognize those.

When you use "-ldevIL", exactly what do your compile and/or link
commands look like, and exactly what errors do you get?

Louis

bilsch

unread,
Apr 22, 2015, 6:33:35 PM4/22/15
to
g++ LUtil.cpp main.cpp LTexture.cpp -w -lGL -lGLU -lglut -ldevIL -o
06_loading_a_texture
/usr/bin/ld: cannot find -ldevIL
collect2: error: ld returned 1 exit status

Jens Thoms Toerring

unread,
Apr 22, 2015, 8:17:12 PM4/22/15
to
bilsch <kin...@comcast.net> wrote:
> On Wed, 22 Apr 2015 09:00:04 -0600, Louis Krupp wrote:
> > On Wed, 22 Apr 2015 11:12:33 +0000 (UTC), bilsch <kin...@comcast.net>
> > wrote:
> >
> > <snip>
> >
> >>I tried linking with -ldevIL and -lilu flags but the linker doesn't
> >>recognize those.
> >
> > When you use "-ldevIL", exactly what do your compile and/or link
> > commands look like, and exactly what errors do you get?

> g++ LUtil.cpp main.cpp LTexture.cpp -w -lGL -lGLU -lglut -ldevIL -o
> 06_loading_a_texture
> /usr/bin/ld: cannot find -ldevIL
> collect2: error: ld returned 1 exit status

From your previous post:

> these libraries [are] located in /usr/lib/i386-linux-gnu/

Are you really on a 32-bit (i386) system? If not the linker
is looking for a 64-bit library and you either have to ex-
plicitely build a 32-bit executable (and then, of course,
you need 32-bit versions of all necessary libraries) - or
you have to get the 64-bit version of the libraries not
found.
Regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de

bilsch01

unread,
Apr 25, 2015, 10:09:20 PM4/25/15
to
Thanks for your comment. I started using Ubuntu on an older desktop.
When I got this laptop (64 bit) I used the same CD to install Ubuntu
(32-bit) on the laptop and never thought twice about it. As a result of
your post I have now upgraded to Ubuntu 14.04 64-bit. Alas, I have the
same problem compiling and linking the job.

Louis Krupp

unread,
Apr 26, 2015, 6:19:22 PM4/26/15
to
On Wed, 22 Apr 2015 22:32:25 +0000 (UTC), bilsch <kin...@comcast.net>
wrote:

>On Wed, 22 Apr 2015 09:00:04 -0600, Louis Krupp wrote:
>
>> On Wed, 22 Apr 2015 11:12:33 +0000 (UTC), bilsch <kin...@comcast.net>
>> wrote:
>>
>> <snip>
>>
>>>I tried linking with -ldevIL and -lilu flags but the linker doesn't
>>>recognize those.
>>
>> When you use "-ldevIL", exactly what do your compile and/or link
>> commands look like, and exactly what errors do you get?
>>
>> Louis
>
>g++ LUtil.cpp main.cpp LTexture.cpp -w -lGL -lGLU -lglut -ldevIL -o
>06_loading_a_texture
>/usr/bin/ld: cannot find -ldevIL
>collect2: error: ld returned 1 exit status

It sounds as if libdevIl.so (or libdevIl.a, if you're linking
statically) isn't in the linker's library search path. You might try
getting verbose output from the linker by adding "-Wl,-v" to your
compile command; it should tell you which directories it's searching
for libraries. These will be directories will be prefixed by "-L".

If libdevIl.so (or libdevIl.a) is in a directory that the linker isn't
searching, you'll probably have to add your own -L<directory name> to
the compile command.

Louis
0 new messages