Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: kalxas on October 21, 2005, 03:19:56 pm

Title: Problem linking a dll in a console application
Post by: kalxas on October 21, 2005, 03:19:56 pm
Hello everyone!

I am trying developing a console application for image processing. I use the FreeImage library which is available through a .dll file and a .lib file for linking.
In the past, when I used DevC++ (just before finding out about C::B), linking my main routine to the dll was working ok using the .lib file.
Now, after I build all my .a files (works ok with the FreeImage.dll), I try to compile my main routine for testing and I get the following message from the compiler:

C:\Program Files\msys\mingw\bin\..\lib\gcc\mingw32\3.4.4\..\..\..\..\mingw32\bin\ld.exe: cannot find -lFreeImage.lib
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

I suppose, that the linker cannot find the .lib file, but I have linked it in Project->Build options->Linker->Link Libraries...

I don't see why this is happening.
Any ideas?

Thanks
Kalxas
Title: Re: Problem linking a dll in a console application
Post by: thomas on October 21, 2005, 03:43:28 pm
Apparently, you are linking against -lFreeImage.lib.

Either pass -lFreeImage.lib to the compiler via "extra options", or link against FreeImage.lib.
Linking against -lFreeImage.lib will fail because there is no such file.
Title: Re: Problem linking a dll in a console application
Post by: kalxas on October 21, 2005, 04:11:25 pm
I provide FreeImage.lib to the linker (at least that is the file I select to the compiler options window)

I just saw the advanced options button, but there isn't a list of linked libs that I can modify...

Can you please be more specific?
Thanks.

Kalxas
Title: Re: Problem linking a dll in a console application
Post by: rickg22 on October 21, 2005, 05:18:56 pm
Hmmm is it just me, or the new organization of the link libraries was not added in RC1?

Anyway I think there was a bug in RC1 regarding filenames. Try renaming your library to freeimage.a . That should do it :)
Title: Re: Problem linking a dll in a console application
Post by: kalxas on October 22, 2005, 03:25:38 pm
I renamed the .lib file to .a but no luck...
I will download the latest cvs source and compile with it...

 :)

Thanks
Kalxas