User forums > Using Code::Blocks

OpenIL/DevIL .lib/.dll problems

(1/2) > >>

Decrius:
Hello,

I tried to get DevIL (previously called OpenIL, an image library for OpenGL) running, without succes yet.

I downloaded the Win32 package, placed all the include file (.h) in "include/IL/" and the .lib files, .exp files and .dll files in the "lib/" directory. I even tried to put the .dll files in "windows/system32/". I include all the header files, and use Project -> Build options -> Linker -> Add to add all the .lib files.

I don't know where to place the .dll files, and what .exp files are. This is what I get when I want to initialize the image library:


--- Code: ---Project   : GLFW Application
Compiler  : GNU GCC Compiler (called directly)
Directory : G:\Documents and Settings\Taco\Bureaublad\Coding\C\GLFW\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: glfw.exe
.objs\main.o:main.cpp:(.text+0x5b8): undefined reference to `_imp__ilInit@0'
.objs\main.o:main.cpp:(.text+0x5bf): undefined reference to `_imp__iluInit@0'
.objs\main.o:main.cpp:(.text+0x5cd): undefined reference to `_imp__ilutRenderer@4'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

--- End code ---

I saw that the text "_imp__ilInit@0" etc, are in the library files. So whats wrong, .dll or .lib files? Or something else ^^,

Thank you very much,

Decrius

MortenMacFly:

--- Quote from: Decrius on December 27, 2006, 10:36:32 am ---I saw that the text "_imp__ilInit@0" etc, are in the library files. So whats wrong, .dll or .lib files?

--- End quote ---
Libs are for *linking*, DLL's are (usually) for *run-time*. There is a way to link against DLL's, too but this is something special. So in your case it's a *linker* error. The linker complains that it cannot resolve external symbols that originate from the DevIL library (obviously - I don't know DevIL). So you are missing to link against one or more DevIL libraries.
To better analyse the compiler/linker process I suggest you enable "full logging" - see my sig.
Then re-post the error but I'm sure you can resolve it easily yourself by adding the appropriate lib to link against in the project/target options.
With regards, Morten.

Decrius:
Thank you for the reply :)

I also tried another image library, which has only 1 .dll 1 .h and 1 .lib file.

Result:


--- Code: ---Project   : GLFW Application
Compiler  : GNU GCC Compiler (called directly)
Directory : G:\Documents and Settings\Taco\Bureaublad\Coding\C\GLFW\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe    -L"J:\Program Files\CodeBlocks\lib" -o glfw.exe .objs\main.o      -lglut32 -lglu32 -lopengl32 -lfreeimage   -lglfw -lopengl32 -lglu32 -luser32 -lkernel32 -lgdi32  -mwindows
/mingw/lib/crt2.o:crt1.c:(.text+0x16a): undefined reference to `__cpu_features_init'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
--- End code ---

Maybe I don't use the linker right?

FreeImage.lib (shouldn't it be .a?) is placed in the lib directory. Build -> Compiler Options -> Linker -> right text area is where I put this line:

-lfreeimage

Decrius

MortenMacFly:

--- Quote from: Decrius on December 28, 2006, 02:54:48 pm ---
--- Code: ---/mingw/lib/crt2.o:crt1.c:(.text+0x16a): undefined reference to `__cpu_features_init'

--- End code ---

--- End quote ---
This could be an outdated mingw version, a conflict in the compiler and Win32 API libraries (that usually ship with MinGW) or simply a wrong (incompatible) library. Did you overwrite / mix / extract manually some libs into your (a wrong) MinGW folder?


--- Quote from: Decrius on December 28, 2006, 02:54:48 pm ---FreeImage.lib (shouldn't it be .a?) is placed in the lib directory. Build -> Compiler Options -> Linker -> right text area is where I put this line:

--- End quote ---
Yes, to be fully GCC compatible you better should use a freeimage library that has been built with MinGW, too. However, the MinGW compiler can hadle most *.lib libraries, too. You can use e.g. the DevPak plugin to download a "pure" MinGW version of freeimage. I believe the GnuWin32 project does offer a "native" variant, too.

In addition: Although the setup in correct in principle it's be better to do it this way:
In the projects build options select the "linker" tab. Add the library "freeimage.a" on the left side using the "add" button. Very perfect would be to just add "freeimage" there (no path, nothing else) and add the path to this lib in the linker directories.

With regards, Morten.

Decrius:
I might have mixed libs yes, and its very outdated, can I just overwrite the old MinGW with a new one? Or is it really better if I use NBs? (Read other topic of me)

Thanks,

Decrius

Navigation

[0] Message Index

[#] Next page

Go to full version