Author Topic: DevIL (LIB Files?)  (Read 17236 times)

Aardwolf

  • Guest
DevIL (LIB Files?)
« on: January 25, 2007, 03:18:10 am »
I don't understand this, and the Wiki / FAQ didn't really help as its instructions are for an outdated version (I think):

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

What is the correct procedure for linking with non-standard libraries, particularly DevIL?

(I am trying to do OpenGL and need DevIL to help)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: DevIL (LIB Files?)
« Reply #1 on: January 25, 2007, 03:30:30 am »
Quote
For your project :
- Right click on the project then select Build options
- Select the directories tab
- Add the required paths for compiler and linker.
- Add your specific libraries in the linker tab.
- Pay attention to project settings and target settings.

These directions look correct to me; why do you think they won't work?
I only thing I am not sure about is what "project settings" you should pay attention to.

Tim S
« Last Edit: January 25, 2007, 03:32:45 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #2 on: January 25, 2007, 03:40:30 am »
Alright, then. Maybe I misread it, but I still don't get it.

What are the required paths for compiler and linker? Do I put my .lib files in /lib and add that? Do I put my .h files in /include and add that?

(I haven't used C++ in ages, so I'm effectively learning it for a first time... again)

As for what the 'version' thing was, I guess I was just thrown off by the fact that there is an extra linker tab that appears when you are inside the directories tab, and this linker tab only let me add directories.

Edit:

It is giving ".objs\texturemanager.obj:texturemanager.cpp:(.text+0x30e): undefined reference to `_imp__ilutGLLoadImage@4'" type errors, although there are more than one of them, and the thing after imp__ varies.
« Last Edit: January 25, 2007, 03:42:05 am by Aardwolf »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: DevIL (LIB Files?)
« Reply #3 on: January 25, 2007, 04:57:39 am »
For your project :
- Right click on the project then select Build options
- Select the directories tab
- Add the required paths for compiler and linker.
- Add your specific libraries in the linker tab.
- Pay attention to project settings and target settings.

To expand on the directions

under directories tab
  under compiler tab
     put the path to the include file

under directories tab
  under linker tab
     put the path to the library file

under linker tab
  under Link Libraries
     put the libraries names (add them one library at a time; one library per line)


The undefined reference to `_imp__ilutGLLoadImage@4 means you are most likely missing a library. That library contains a method related to _imp__ilutGLLoadImage@4 (this is the c++ mangled name for the method.)

Tim S


« Last Edit: January 25, 2007, 05:03:32 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #4 on: January 25, 2007, 05:33:55 am »
I don't know for sure, but I think the problem is in the last bit (the errors). Maybe.

(n00b question) Where do DLLs go?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: DevIL (LIB Files?)
« Reply #5 on: January 25, 2007, 06:36:35 am »
I don't know for sure, but I think the problem is in the last bit (the errors). Maybe.

(n00b question) Where do DLLs go?

What compiler are you using?
Which DLLs?
Are you using them?
Or making them?
If you did NOT make them who did?

Note: You get linker errors on library NOT normally on DLLs, if the DLLs are in the wrong location you get runtime errors.

Tim S
« Last Edit: January 25, 2007, 06:43:05 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #6 on: January 25, 2007, 06:52:26 am »
Compiler is GCC (but about every other time I build the project it says something like cannot find ming32 something \1 and then the same thing \2)

The DLLs are DevIL, ILU, and ILUT.

They were made by whoever made DevIL (it's an Image Library, useful (or so I have heard) for working with OpenGL).

If the problem is not in the DLLs, then what is wrong with my LIB files? I put them in a folder and added it both to the project settings and the global settings, but to no avail; it still gives the exact same error.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: DevIL (LIB Files?)
« Reply #7 on: January 25, 2007, 07:06:44 am »
Turn on compiler logging

"Settings" -> "Compiler and Debugger" Tab "Other" Set "Compiler Logging" to "Full Command line"

Do a re-build

Post what the result is so I can see the commands and the errors.

What is the names of the library files include [file] extension?

Tim S
« Last Edit: January 25, 2007, 07:33:47 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #8 on: January 25, 2007, 07:19:12 am »
Project   : OpenGL Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Andrew\Desktop\cpp\CodeBlocks\OpenGL\FirstTry\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe   -Os -O3 /O2 /O1    -I"C:\Program Files\CodeBlocks\include\IL"  -I"C:\Program Files\CodeBlocks\include" -c md2.cpp -o .objs\md2.o
mingw32-g++.exe: /O2: No such file or directory
mingw32-g++.exe: /O1: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

 

Project   : OpenGL Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Andrew\Desktop\cpp\CodeBlocks\OpenGL\FirstTry\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe   -L"C:\Program Files\CodeBlocks\lib" -L"C:\Program Files\CodeBlocks\bin"  -L"C:\Program Files\CodeBlocks\bin" -o "C:\Documents and Settings\Andrew\Desktop\cpp\CodeBlocks\OpenGL\FirstTry\OpenGL.exe" .objs\md2.o .objs\texturemanager.o .objs\main.o        -lopengl32 -lglu32 -lgdi32 -luser32 -lkernel32 "C:\Program Files\CodeBlocks\lib\DevIL.lib" "C:\Program Files\CodeBlocks\lib\ILU.lib" "C:\Program Files\CodeBlocks\lib\ILUT.lib"  "C:\Program Files\CodeBlocks\lib\ILUT.lib" "C:\Program Files\CodeBlocks\lib\DevIL.lib" "C:\Program Files\CodeBlocks\lib\ILU.lib" -mwindows
.objs\texturemanager.o:texturemanager.cpp:(.text+0x11): undefined reference to `_imp__ilInit@0'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x1e): undefined reference to `_imp__ilEnable@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x2e): undefined reference to `_imp__ilutRenderer@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x3e): undefined reference to `_imp__ilutEnable@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x61): undefined reference to `_imp__ilInit@0'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x6e): undefined reference to `_imp__ilEnable@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x7e): undefined reference to `_imp__ilutRenderer@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x8e): undefined reference to `_imp__ilutEnable@4'
.objs\texturemanager.o:texturemanager.cpp:(.text+0x30e): undefined reference to `_imp__ilutGLLoadImage@4'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)



Ignoring the first set of messages, it seems a little odd that there is no -l before each of the "C:\Program Files\CodeBlocks\lib\..." things, is that bad?

I don't know what an 'include extension' is.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: DevIL (LIB Files?)
« Reply #9 on: January 25, 2007, 07:26:07 am »
Do you have any reason to believe that this library DevIL.lib should work with minGW GCC normally an GCC library starts with lib and ends with .a
This looks like a Microsoft Library file.

From
http://gpwiki.org/index.php/DevIL:Tutorials:Basics
Quote
To compile under Windows using MSVC you'll need to create new Win32 Application project and add DevIL.lib, OpenGL32.lib, SDLmain.lib and SDL.lib into link section in project's settings.

MSVC means Microsoft Visual C++

Ignoring the first set of messages, it seems a little odd that there is no -l before each of the "C:\Program Files\CodeBlocks\lib\..." things, is that bad?

Yes, but it really does NOT matter since using MS Libraries with minGW GCC is not possible to my knowledge. Their is ways to convert MS DLLs that are C only to being used by GCC but these appear to be C++ DLLs at first glance. And, it is not easy to do the conversion.

Quote
I don't know what an 'include extension' is.
I meant file extension like .a or .lib in this case.

Tim S

PS, Morten is more of an expect than me I will let him help you. Maybe he sees something I don't.
« Last Edit: January 25, 2007, 07:52:35 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: DevIL (LIB Files?)
« Reply #10 on: January 25, 2007, 07:34:27 am »
I believe the order of the libs is wrong. If e.g. DevIL.lib depends on ILU.lib then this won't work this way. In addition you are linking several libs multiple times. This makes no sense. Check your project and target options (linker) accordingly. What's the right order for the libs to link? Check the SDK's manual, examples or ask the dev's of this lib.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #11 on: January 25, 2007, 08:38:20 am »
D'oh!

I did "some" stuff, and it gave me an error; I searched something I saw in the error and it took me to a page on these forums about not installing the new MinGW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

So... now what do I do?

/mingw/lib/crt2.o:crt1.c:(.text+0x16a): undefined reference to `__cpu_features_init'

^^^ BAD

arturomdn

  • Guest
Re: DevIL (LIB Files?)
« Reply #12 on: January 25, 2007, 10:13:14 am »
I had the same problem trying to use DevIL with Code::Blocks and mingw.

I followed the instructions in this website (translated from German):
http://translate.google.com/translate?hl=en&sl=de&u=http://www.softgames.de/forum/frage103609.html&sa=X&oi=translate&resnum=2&ct=result&prev=/search%3Fq%3D_imp__ilGetInteger%26hl%3Den%26lr%3D%26sa%3DG

These are instructions for converting .DLL to lib*.a suitable for Code::Blocks and mingw.

I downloaded the latest DevIL binaries for Windows

http://internap.dl.sourceforge.net/sourceforge/openil/Devil-1.6.8-rc2-win-.zip

Then issued the following commands, per the instructions:

pexports ILUT.dll > ILUT.def
pexports ILU.dll > ILU.def
pexports DevIL.dll > DevIL.def

dlltool --input-def ILU.def --dllname ILU.dll --output-lib libILU.a
dlltool --input-def ILUT.def --dllname ILUT.dll --output-lib libILUT.a
dlltool --input-def DevIL.def --dllname DevIL.dll --output-lib libDevIL.a

move lib*.a \Dev-Cpp\lib

"c:\Dev-Cpp\lib" is listed in Code::Blocks in Project->Build Options->Directories->Linker

Voila, those pesky _imp__* linker errors went away :-)

Hope this helps.

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #13 on: January 25, 2007, 06:42:39 pm »
Yeah I did something which (I think) was equivalent to that; I did

reimp DevIL.lib
reimp ILU.lib
reimp ILUT.lib

and I put those new .a files in \lib,

but then I discovered that the new version of MinGW had a terrible terrible error:

/mingw/lib/crt2.o:crt1.c:(.text+0x16a): undefined reference to `__cpu_features_init'

So I guess what I'm asking is,
HOW DO I SWITCH TO AN OLDER VERSION OF MINGW and SET UP CODE::BLOCKS TO RECOGNIZE IT?

Aardwolf

  • Guest
Re: DevIL (LIB Files?)
« Reply #14 on: May 15, 2007, 06:51:11 am »
This is what is commonly known as

       THREAD NECROMANCY         


 but...




I have returned to this IDE, MinGW, and DevIL in the hopes that it might help me load JPEG's, which everyone knows are much smaller than BMP files. However, after deciding to actually try what arturomdn said on January 25, 2007, i got exactly the same errors as before.

Suggestions welcome.



Edit (edit not made on a computer with Code::Blocks or my project on it):

I followed arturomdn's suggestion precisely, and while this did manage to fix the problem of it giving an error when it doesn't find the correct static library files, it has resumed with the "undefined reference to '_imp__*'" errors.
« Last Edit: May 15, 2007, 04:25:55 pm by Aardwolf »