Uploading an image using DevIL: Linker errors

It gave me an error message when I tried to download GLFW + openGL:
“The following files were not downloaded due to errors…
File http://www.filefactory.com/file/4d8061/ does not exist”

Ok, then manually download the latest Binary archive for Windows glfw - Download specifically the glfw-2.7.2.bin.WIN32.zip. Not the source download

Then use the lib-mingw build. You only need two files to be copied to where you installed Dev-Cpp. In my particular case that is “C:\Dev-Cpp” if you installed it somewhere else then change accordingly


copy glfw-2.7.2.bin.WIN32\include\GL\glfw.h C:\Dev-Cpp\include\GL
copy glfw-2.7.2.bin.WIN32\lib-mingw\libglfw.a C:\Dev-Cpp\lib

Then in the dev-cpp link parameters always make certain you have “-lglfw -lopengl32”

Thanks so much. All the glfw linker errors vanished like magic. But the other errors returned. Below is the compiler log. My Project-> Project Options-> Parameters-> Linker input currently looks like this:

-lglfw -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -ldevil
-lglew32
-lilu
-lilut
I put -llu and -lilut back because I was still getting the same errors without them. I also realized that the versions for the ilu, ilut and DevIL libraries and dll were different so deleted everyone of them, downloaded the latest version of DevIL and put those files in their correct places.
C:\Dev-Cpp\include\GL
C:\Dev-Cpp\include\IL
C:\Dev-Cpp\lib
C:\Windows\System32

I was expecting it to make a difference but it didn’t.
FYI: I wanted to format the compiler log but I didn’t see any options I could use to do so. I hope you’re able to read it. Thanks.

Compiler: Default compiler
Building Makefile: “C:\Users\annette\Documents\Visual Studio 2010\Projects\Version2\Neutral - Copy (4)\Makefile.win”
Executing make…
make.exe -f “C:\Users\annette\Documents\Visual Studio 2010\Projects\Version2\Neutral - Copy (4)\Makefile.win” all
g++.exe -D__DEBUG__ neutral.o -o “Neutral.exe” -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/lib" -mwindows -lglfw -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -ldevil -lglew32 -lilu -lilut -g3

neutral.o(.text+0x11b): In function Z9loadImagePKc': C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:58: undefined reference to_imp__ilGenImages@8’
neutral.o(.text+0x12b):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:60: undefined reference to _imp__ilBindImage@4' neutral.o(.text+0x13b):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:62: undefined reference to_imp__ilLoadImage@4’
neutral.o(.text+0x158):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:69: undefined reference to _imp__iluGetImageInfo@4' neutral.o(.text+0x16b):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:72: undefined reference to_imp__iluFlipImage@0’
neutral.o(.text+0x181):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:77: undefined reference to _imp__ilConvertImage@8' neutral.o(.text+0x194):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:82: undefined reference to_imp__ilGetError@0’
neutral.o(.text+0x287):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:102: undefined reference to _imp__ilGetData@0' neutral.o(.text+0x297):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:102: undefined reference to_imp__ilGetInteger@4’
neutral.o(.text+0x2aa):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:102: undefined reference to _imp__ilGetInteger@4' neutral.o(.text+0x2bd):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:102: undefined reference to_imp__ilGetInteger@4’
neutral.o(.text+0x2d1):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:102: undefined reference to _imp__ilGetInteger@4' neutral.o(.text+0x31b):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:114: undefined reference to_imp__ilGetError@0’
neutral.o(.text+0x374):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:119: undefined reference to _imp__ilDeleteImages@8' neutral.o(.text+0x614): In functionZ6initGLii’:
C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:194: undefined reference to _imp__iluGetInteger@4' neutral.o(.text+0x62c):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:194: undefined reference to_imp__iluGetInteger@4’
neutral.o(.text+0x644):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:194: undefined reference to _imp__ilutGetInteger@4' neutral.o(.text+0x68e):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:201: undefined reference to_imp__ilutRenderer@4’
neutral.o(.text+0x698):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:202: undefined reference to _imp__ilInit@0' neutral.o(.text+0x69f):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:203: undefined reference to_imp__iluInit@0’
neutral.o(.text+0x6a6):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:204: undefined reference to _imp__ilutInit@0' neutral.o(.text+0x6b4):C:/Users/annette/Documents/Visual Studio 2010/Projects/Version2/Neutral - Copy (4)/neutral.cpp:205: undefined reference to_imp__ilutRenderer@4’
collect2: ld returned 1 exit status

make.exe: *** [Neutral.exe] Error 1

Execution terminated

anette, why not give stb_image a try? You can include it in your project without any hassle or downloading of libraries.

Try this:

  • add the .c file to your project
  • when including the library do this:

#ifndef STBI_HEADER_FILE_ONLY
# define STBI_HEADER_FILE_ONLY
#endif // STBI_HEADER_FILE_ONLY
#include "stb_image.c"

That’s all! Enjoy! The sooner you forget about DevIL, the better.

I’ll check it out. I just checked briefly and it looks like stb_image does not support .tiff files which I am using. I may have to convert my .tiff images to .jpeg first and then use it and see if it works. But I’ll look into it. Thanks

Yeah, and there’s a nifty library called >>tvmet<< for your vector needs :).

You can also convert to .png, if you don’t want to lose quality of your images.

DevIL is a good library to be able to use. It is good to suggest use of alternatives but it is also valuable to learn how to setup up the compiler tools. The common windows way of passing around a c-file (to avoid this library stuff) to every project can become overly cumbersome. Having compiled libraries in a standard shared location is a good paradigm to foster.

For dev-cpp, and any XYZ library, it is just a matter of getting the correct libXYZ.*a, header files, maybe a XYZ.dll, and specifying the link option -lXYZ. That’s usually it. The question for me is why was it so simple on my setup to get glfw and devil working but not so for this user’s post?

Back to the post, once you deleted the IL* files where exactly did you get the new ones to replace them? Did you download or use the zip file that contained the ones that “worked” before glfw was fixed?

DevIL is a good library to be able to use. It is good to suggest use of alternatives but it is also valuable to learn how to setup up the compiler tools. The common windows way of passing around a c-file (to avoid this library stuff) to every project can become overly cumbersome. Having compiled libraries in a standard shared location is a good paradigm to foster.
For some reason many people are unwilling to make the investment of time to learn this. To them this is a command-line thing and they prefer using python or some other scripting language - a pity, many good potential C/C++ programmers are lost this way, I think.

The truth in my opinion is that IDEs don’t really make things easier, people just need to learn the “command-line thing” or use some grand M$ product.

I downloaded a new DevIL zip file from their website and used that. I didn’t use the zip file that contained the DevIL files that worked before gllfw was fixed. I made this decision because even with the old DevIL, it still didn’t work.

I tried to compile this program on another machine this morning. Since glew and glfw were not on that machine, I got one error message saying it could not find lglew and lglfw. So I put the header and library files for these two on the new machine and those errors went away. I did the same for lDevIL. Then I got an error message saying it could find lilu too. So I put the folder IL, containing il ilu and ilut in the “include” folder in Dev-cpp and put their library files in the “lib” folder. Then, all the past errors came back. This tells me the problem is with the il, ilu and ilut files. These files are in the IL folder in Dev-cpp folder. Should they be somewhere else? Am I right by including:

#include <IL/il.h>
#include <IL/ilu.h>
#include <IL/ilut.h

in my code?

I don’t know what else I’m doing wrong. Under “Parameters” in Project Options, I have:
-lglfw -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -ldevil
-lglew32
-lilu
-lilut

In the “Directories” section:
Under “Library directories” I have: C:\Dev-Cpp\lib
Under “Include directories” I have C:\Dev-Cpp\include\GL
C:\Dev-Cpp\include\IL

In systems32 I have all the dlls for the various files in there. What else I am missing? Please help me with this one.

Also, this is how I have the header files set up in my program.

#include <iostream>
#include <windows.h>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>

#include <GL/glew.h> // Include OpenGL headers
#include <GL/glfw.h> // Include OpenGL Framework headers

#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>

#define GLUT_USE_OPENGL // This MUST be defined before calling
//the DevIL headers or we don’t get
//OpenGL functionality
#include <IL/il.h>
#include <IL/ilu.h>
#include <IL/ilut.h>

using namespace std;

Should they be arranged differently? I know for example,
#include <GL/glew.h> // Include OpenGL headers
#include <GL/glfw.h> // Include OpenGL Framework headers

must come before the IL header files. I’m just thinking of all possibilities right now.

By MS, did you mean Microsoft? Well, I could have used Visual Studio C++ but we are required to use Dev-C++ for this project.

Finally, I solved it. The program is compiling now. I found the solution from another post on www.codeproject.com. I went to Devpak.org and downloaded DevIL. You can google “devpak DevIL” and choose the “DevIL Library Version-Devpak repository” option. Then I opened my program in Dev-C++ and went to Tool->Package Manager-> and clicked on install. I followed the Wizard directions. It asked me to upload the package I had just downloaded. Once the installation was complete, DevIL was added to the packages in package manager. That’s all I had to do. To verify that all the libraries were on my machine, I went to C:\Dev-cpp\lib

I saw all the ilu and ilut libraries: the object libraries and those ending in .a. I think the files ending in .a were the ones the compiler was looking for, and not the object library files. Extra DevIL files were added to the DevIL files that were already there.

Once I installed DevIL and compiled the program, all the errors went away. Now I can concentrate on getting the images to actually upload. Thank you all so much for helping. I hope this discussion will help someone else also. Thanks again.