在 Visual C++ 2010 中安装 Magick++ [英] Installing Magick++ in Visual C++ 2010

查看:53
本文介绍了在 Visual C++ 2010 中安装 Magick++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近为 C++ 安装了 ImageMagick 库.我之前没有使用 C++ GUI 的经验,但我很擅长 C++ 命令行编程.

I have recently installed ImageMagick libraries for C++. I have no prior experience with C++ GUI but I'm very good in C++ command line programming.

我已经通过 .exe 文件在 Windows 中安装了 ImageMagick,并将库和头文件复制到 C++,但是每当我尝试运行任何演示程序时,我总是收到此错误:

I have installed ImageMagick in Windows through an .exe file and copied libraries and header files to C++ but whenever I try to run any demo program I am consistently getting this error:

1>------ Build started: Project: Sufiyan, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?write@Image@Magick@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::pixelColor(long,long,class Magick::Color const &)" (__imp_?pixelColor@Image@Magick@@QAEXJJABVColor@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Color::~Color(void)" (__imp_??1Color@Magick@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Geometry::~Geometry(void)" (__imp_??1Geometry@Magick@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Image::Image(class Magick::Geometry const &,class Magick::Color const &)" (__imp_??0Image@Magick@@QAE@ABVGeometry@1@ABVColor@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Geometry::Geometry(char const *)" (__imp_??0Geometry@Magick@@QAE@PBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Color::Color(char const *)" (__imp_??0Color@Magick@@QAE@PBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Magick::InitializeMagick(char const *)" (__imp_?InitializeMagick@Magick@@YAXPBD@Z) referenced in function _main
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Z-Axis\documents\visual studio 2010\Projects\Sufiyan\Debug\Sufiyan.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

这些是我的笔记本电脑规格:

These are my laptop Specs:

  • Windows 7 64 位.
  • Visual C++ 2010 Express x86
  • ImageMagick x86

这是我尝试安装它的方式:

This is how I tried installing it:

  1. 已安装 Visual C++ 2010 Express
  2. 已安装 ImageMagick
  3. 复制 ImageMagick Lib 并包含在 Visual C++ 2010 中
  4. 选定的 Win32 -> Windows -> 空项目(无效)
  5. 选定的 Win32 -> DLL(无效)
  6. 选定的 Win32 -> 静态(无效)

但是当我运行任何代码时,它会给出上面提到的错误.

but when I run any code it gives the error mentioned above.

有人提出了这个解决方案:

Someone has suggested this solution:

你需要一个起点,去
c:\Program Files\ImageMagick-6.8.1-Q16\Magick++_demos.
单击工作区"按钮,构建并运行.
假设成功,将按钮工作区用作您自己的自定义代码的模板.

You need a starting point, go to
c:\Program Files\ImageMagick-6.8.1-Q16\Magick++_demos.
Click on the button workspace, build, and run.
Assuming that's successful, use the button workspace as a template for your own custom code.

我也试过这个,几十次,但不断收到这个错误:

I've tried this too, dozens of times, and am continuously getting this error:

项目必须转换为当前的 Visual C++ 项目格式.
转换后,您将无法在早期版本的 Visual Studio 中编辑此项目.转换并打开这个项目?

The Project must be Converted to current Visual C++ project format.
After it has been converted you will not be able to edit this project in previous version of visual studio. Convert and open this project ?

当我点击 Yes 没有任何反应,屏幕上没有任何显示 - 空白的 Visual C++ 屏幕,没有打开项目.

When I click Yes nothing happens, nothing shows on the screen - blank Visual C++ screen with no project open.

我非常想知道:是什么导致了这个错误,为什么演示程序也无法运行?

I desperately want to know: What is causing this error and why even the demo programs are not working?

推荐答案

尝试自己构建ImageMagick,问题可能来自不同版本的编译器.

Try to build ImageMagick yourself, the problem may come form the different version of compiler.

按照ImageMagick 的高级 Windows 安装中的说明进行操作.在上页的最后,有链接错误的解决方案,请确保您已设置预处理器.我只是跟着它成功构建了一个项目.

Follow the directions in Advanced windows installation of ImageMagick. At end of the above page, there is a solution of link error, make sure you have set the preprocessor. I just followed it to build a project successfully.

这篇关于在 Visual C++ 2010 中安装 Magick++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆