找不到Magick ++头文件 [英] Cannot find Magick++ header files

查看:599
本文介绍了找不到Magick ++头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望我的人完全迷失了自己,可以帮助我.我已经拖网了,真的找不到更多的帮助我了.

Hoping someone can help me out as I'm at a complete loss. I've trawled the Internet and really can't find anything more to help me.

我正在尝试编译使用Magick ++库的c ++程序.我已经安装了Magick ++似乎还不错.在我的当前目录中,位于main.cpp上,并且我正在运行g++ main.cpp.我遇到以下错误...

I'm trying to compile my c++ program which uses the Magick++ library. I've installed Magick++ seemingly fine. In my current directory is located main.cpp and I'm running g++ main.cpp. I'm getting the following error...

In file included from main.cpp:3:0:
/home/simeon/ImageMagick-6.8.9-0/Magick++/lib/Magick++.h:9:30: fatal error: Magick++/Include.h: No such file or directory
compilation terminated.

要尝试解决该问题,我在main.cpp中声明了Magick ++.h的绝对路径,因此我认为这似乎行得通...

To try and get around the problem I'm declaring the absolute path to Magick++.h in my main.cpp so I have this which seems to be working...

#include "/home/simeon/ImageMagick-6.8.9-0/Magick++/lib/Magick++.h"

该错误发生在Magick ++.h的第9行(由于我的绝对路径而发现),看起来像这样...

The error occurs on line 9 in Magick++.h (which it's finding due to me absolute path) which looks like this...

#include <Magick++/Include.h>

这是我很困惑的地方,因为此文件确实存在于它所说的位置.如果我跑

This is where I'm confused because this file does exist in the place it says it is. If I run

 cat /home/simeon/ImageMagick-6.8.9-0/Magick++/lib/Magick++/Include.h

然后该文件将毫无问题地打开并显示其内容.

then the file opens without problem and shows its contents.

有人对发生的事情有任何建议吗?我不明白为什么我根本不需要指定绝对路径,以及为什么g ++首先找不到头文件.我能以某种方式告诉g ++在特定位置查找Magick ++标头吗?

Does anyone have any suggestions as to what's going on please? I don't understand why I need to specify an absolute path at all and why g++ isn't finding the header files in the first place. Is there somehow I can tell g++ to look for Magick++ headers in a specific place?

提前谢谢! Simeon

Thanks in advance! Simeon

推荐答案

由于您使用的是Linux,所以我认为您可以安装安装随附的imagemagick软件包.我所知道的所有版本的Linux上都可以使用它.

Since you are under Linux, I would think you can install the imagemagick package that comes with your installation. It's available on all flavors of Linux I know of.

在Debian/Ubuntu下,会是这样的:

Under Debian/Ubuntu it would be something like this:

sudo apt-get install libmagick++-dev

否则,我个人将使用 cmake 进行所有设置.这是一个学习曲线.但是在我看来,如果您的命令行是:

Otherwise, I personally would use cmake to do all the setup. It's a bit of a learning curve. But it seems to me that if your command line is:

g++ main.cpp

然后,您在命令行上缺少几个-I选项.安装软件包可能不需要您使用-I选项(我使用cmake,并且并不真正注意那些事情……它对我有用.)

Then you are missing a couple -I options on your command line. Installing the package may not require you to use the -I option (I use cmake and don't really pay attention to those things... it just works for me.)

因此,要解决您的问题,您可能需要这样的东西:

So to solve your problem, you probably need something like this:

g++ -I/home/simeon/ImageMagick-6.8.9-0/Magick++/lib main.cpp

但是,如果只有一个.cpp文件,则可能要使用-o myprog命令行选项.

If you have a single .cpp file, although, you may want to use a -o myprog command line option.

这篇关于找不到Magick ++头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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