Magick++ in VS2010 - unresolved external symbol

妖精的绣舞 提交于 2019-12-01 17:59:17

CORE_RL_Magick++_.lib does contain ?InitializeMagick@Magick@@YAXPEBD@Z, but not ?InitializeMagick@Magick@@YAXPBD@Z

Using the undname.exe utility, these names undecorate to:

void __cdecl Magick::InitializeMagick(char const *)
void __cdecl Magick::InitializeMagick(char const * __ptr64)

Note the __ptr64 declarator you got on the argument. You've got some kind of compile setting that turns that char* into a 64-bit pointer. Like compiling this code targeting a 64-bit operating system. But linking the 32-bit .lib. This normally generates a linker error about the bit-ness of the .lib being wrong, not so sure why you don't see this. Maybe a mingw artifact, not sure how it works.

You should also indicate to Visual Studio the .lib to be used for linking

in Linker -> Input -> Additionnal Dependencies

EDIT: and put the path of the magick library

in Linker -> General -> Additionnal Library Directories

EDIT2: if it still doesnt work, then you are calling a fonction with a wrong exported signature. Launch the msdev tool Dependency Walker. And check if the magick.lib really exports the function whose name is ?InitializeMagick@Magick@@YAXPBD@Z

I am wrong it's not a microsoft tool: Dependency Walker

I was wrong Dependency Walker doesnt open .lib, only Dlls and Exes. However since you have found ?InitializeMagick@Magick@@YAXPBD@Z in the content of the .lib file, it means that it is reaaly exported this way.

EDIT3: Are you SURE the name and the folder of the additionnal library is correct. I really cannot think of another reason for Visual C++ being unable to link with your library. If your .lib DO contains the string ?InitializeMagick@Magick@@YAXPBD@Z I really think it should link.

EDIT4: could you paste from the file <Magick++.h> the prototype definition of InitializeMagick ? there is something that makes it be compiled differently between visual c++ and your library supplier. ?InitializeMagick@Magick@@YAXPEBD@Z and ?InitializeMagick@Magick@@YAXPEBD@Z are two DIFFERENT signatures. When including <Magick++.h> Visual C++ understands its differently. (that's why I need to see the prototype of the function)

You should also indicate to Visual Studio the .lib to be used for linking in Linker -> Input -> Additionnal Dependencies

Thank you! The additional dependecies line contains now the following text (look at the end): kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;C:\Program Files\ImageMagick-6.6.6-Q16\lib\CORE_RL_Magick++_.lib

It still does not work. Is it the wrong .lib file?

what is this .lib file for? Shouldn't source code just work? There isn't any DLL...

The documentation says: "Windows users may get started by manually editing a project file for one of the Magick++ demo programs." Did you try that?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!