Page 1 of 1

50 link errors trying to use static lib in vs2008

Posted: 2010-06-06T10:28:02-07:00
by eric_vi
Hello,

i am trying desperatly to have my vs2008 x64 project to use image magick static DLL...

through configure in x64 mode and all I have built a set of static .lib that are in my ViusalMagick/Lib without problem

now i have added them to the configuration linker input additional dependencies of visual studio, the option directories point to those

also the precompiler has everything set like in the magick exemple...


when i do link, i got 50 errors all related to ImageMagick, like the vs project is not seeing the libraries... i have spent 1 full day trying to figure out and redoing all the steps again, without success...

i am missing something i am not sure what, an exemple showing a vs project with static dll would be good, could not find any (only dynamic :( ), all hints would be more than welcome

Thanks

NOTE i have been able to have the same project running with dynamic DLL, but i need to deploy my project so i need static dll


Code: Select all

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Magick::InitializeMagick(char const *)" (__imp_?InitializeMagick@Magick@@YAXPEBD@Z) referenced in function "short __cdecl initHSCEdit(int,char * * const)" (?initHSCEdit@@YAFHQEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Magick::Image::compressType(enum MagickCore::CompressionType)" (__imp_?compressType@Image@Magick@@QEAAXW4CompressionType@MagickCore@@@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Magick::Image::quantize(bool)" (__imp_?quantize@Image@Magick@@QEAAX_N@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Magick::Image::quantizeColors(unsigned __int64)" (__imp_?quantizeColors@Image@Magick@@QEAAX_K@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Magick::Image::quantizeDither(bool)" (__imp_?quantizeDither@Image@Magick@@QEAAX_N@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Magick::Image::frame(class Magick::Geometry const &)" (__imp_?frame@Image@Magick@@QEAAXAEBVGeometry@2@@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl Magick::Geometry::Geometry(char const *)" (__imp_??0Geometry@Magick@@QEAA@PEBD@Z) referenced in function "int __cdecl testMagick(char * *)" (?testMagick@@YAHPEAPEAD@Z)


Re: 50 link errors trying to use static lib in vs2008

Posted: 2010-06-06T10:48:02-07:00
by magick
We need a sane starting point. Install http://www.imagemagick.org/download/bin ... static.exe. Now move to c:/Program Files/ImageMagick-6.6.2-2-Q16/Magick++_demos (the exact location depends on your system). Click on the Button program. Build and execute. Does that work? If so, use the Button workspace as a template for your own project.

Re: 50 link errors trying to use static lib in vs2008

Posted: 2010-06-06T12:15:57-07:00
by eric_vi
thank you for your fast answer... i tried this first, one problem is Magick++_demos is not in this distribution, could not find any /lib either... it seems only 6.5.8 has that

Re: 50 link errors trying to use static lib in vs2008

Posted: 2010-07-14T03:15:46-07:00
by romatou18
magick wrote:We need a sane starting point. Install http://www.imagemagick.org/download/bin ... static.exe. Now move to c:/Program Files/ImageMagick-6.6.2-2-Q16/Magick++_demos (the exact location depends on your system). Click on the Button program. Build and execute. Does that work? If so, use the Button workspace as a template for your own project.
Hi Magick,

I had the same error as eric_vi.
I have tried using the demo project workspace and it worked fine.
I have also found a way to make my own project working, specifying the includes and the libs location in the link properties of VS2008.
However I could not find another way to make the project working than copying all the ImageMagick DLL I have compiled from the sources, into my program executable location.

My question is the following : How is specified the dll location in the demo project ? Because none of the DLLs are in the executable directory, and after having examine and edited every files in the demo workspace i could not find how you do enable the executable to find the DLLs even though they are not in the C:\windows\sys64wow dir or c:\windows\system32 dir.

Could you shed a light, I would really like not only to use the demo workspace but understand how you do that to avoid problems in the future.

Many thanks

Romain S

Re: 50 link errors trying to use static lib in vs2008

Posted: 2010-07-14T03:41:11-07:00
by romatou18
magick wrote:We need a sane starting point. Install http://www.imagemagick.org/download/bin ... static.exe. Now move to c:/Program Files/ImageMagick-6.6.2-2-Q16/Magick++_demos (the exact location depends on your system). Click on the Button program. Build and execute. Does that work? If so, use the Button workspace as a template for your own project.

Hi Magick,

More precision on my previous message :

When i run the button project from the demo projects dir in ImageMagick (ver 6.6.3-Q16), I get the following messages :
'button.exe': Loaded 'C:\Program Files (x86)\ImageMagick-6.6.3-Q16\CORE_RL_Magick++_.dll'
'button.exe': Loaded 'C:\Program Files (x86)\ImageMagick-6.6.3-Q16\CORE_RL_magick_.dll'
'button.exe': Loaded 'C:\Program Files (x86)\ImageMagick-6.6.3-Q16\X11.dll', Binary was not built with debug information.

I have define the MAGICK_HOME env variable added it to my PATH var, but nothing has changed.
BUt with that particular demo project, even while editing the resource.h, the rc file, examining EVERY single properties in the project configuration page, I could not find a trace of C:\Program Files (x86)\ImageMagick-6.6.3-Q16\.

On top of that I have move the "button" project to another directory and tried to run it again (updating the lib and include path, to my own libs and includes location, not the one in C:\Program Files (x86)\ImageMagick-6.6.3-Q16\) and it is still working.

So where should I look to, to find the explanation ?

Many thanks in advance

Romain S