Author Topic: Problem linking a dll in a console application  (Read 3501 times)

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Problem linking a dll in a console application
« 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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem linking a dll in a console application
« Reply #1 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem linking a dll in a console application
« Reply #2 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

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Problem linking a dll in a console application
« Reply #3 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 :)

Offline kalxas

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem linking a dll in a console application
« Reply #4 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