Magick++ in VS2010 - unresolved external symbol

前端 未结 4 1071
孤独总比滥情好
孤独总比滥情好 2021-01-18 11:52

I\'m trying to use ImageMagick Magick++ for a C++ Project in VS2010. I installed the Library from here: klick

Then in my Project, I added c:/program files/ImageMagick

相关标签:
4条回答
  • 2021-01-18 12:32

    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)

    0 讨论(0)
  • 2021-01-18 12:35

    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?

    0 讨论(0)
  • 2021-01-18 12:44

    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.

    0 讨论(0)
  • 2021-01-18 12:45

    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...

    0 讨论(0)
提交回复
热议问题