Linking DevIL

I'm trying to write some code to load images into OpenGL using a library called DevIL (openil.sourceforge.net). However, every time I build I get a linker error.

Here is a test program I made.

1
2
3
4
5
6
7
#include <il\il.h>

int main(int, char**)
{
   ilInit();
   return 0;
}


The error is:
obj\Debug\test.o In function `main':
C:\...\test.cpp line 5: undefined reference to `_imp__ilInit@0'

I have linked the DevIL static library DevIL.lib. I am using Codeblocks with MinGW. I suspect the problem may be to do with C++ function name scrambling, but I don't know what to do about it. Does anyone have any suggestions?

Update: I am aware that I should really use a '.a' static library with MinGW. However this would involve recompiling the source code myself the website doesn't offer one. I would rather avoid doing this since it involves hunting down each of the individual dependencies like libpng (and thus having to worry about their licenses etc.).

Update: I have now tried again with Visual C++ Express 2010. It still doesn't work. I have definitely linked the DevIL.lib library, but the linker keeps telling me there's an unresolved external.
Last edited on
OK. Don't worry. I'm using a different library altogether now and it seems to be working.
Topic archived. No new replies allowed.