ImageMagick 开源库 windows XP SP3 VS2008 下开发读图片就报错。
ImageMagick 开源库 windows XP SP3 VS2008 下开发读图片就报错。
1.我安装的是最新的ImageMagick-6.8.5-Q8——X86.DLL版的
2.例子是库自己带的domeo 里面的button
3.一编译button工程就会报错 错误在button.read( backGround );
4.请求帮助怎么使用和解决这个读图片就错误的问题。使用过的这个库的朋友帮忙指点。
5.不要跟我说什么linux,linux没学过,扯远没用;不要跟我说用什么Cximage 因为下载老外的一个工程用了ImageMagick我水平暂时没那么高把ImageMagick替换了。
6.我上google 百度查了下可能跟环境变量有关,但是英语水平及VS平台有限不能判断也未解决。所有请高手~高高手~~~~~高~~~~手指点迷津。
#include <Magick++.h>ImageMagick Windows?XP 读图片报错 库 开源
#include <string>
#include <iostream>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
try {
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
//
// Options
//
string backGround = "xc:#CCCCCC"; // A solid color
// Color to use for decorative border
Color border = "#D4DCF3";
// Button size
string buttonSize = "120x20";
// Button background texture
string buttonTexture = "granite:";
// Button text
string text = "Button Text";
// Button text color
string textColor = "red";
// Font point size
int fontPointSize = 16;
//
// Magick++ operations
//
Image button;
// Set button size
button.size( buttonSize );
// Read background image
button.read( backGround );
// Set background to buttonTexture
Image backgroundTexture( buttonTexture );
button.texture( backgroundTexture );
// Add some text
button.fillColor( textColor );
button.fontPointsize( fontPointSize );
button.annotate( text, CenterGravity );
// Add a decorative frame
button.borderColor( border );
button.frame( "6x6+3+3" );
button.depth( 8 );
// Quantize to desired colors
// button.quantizeTreeDepth(8);
button.quantizeDither(false);
button.quantizeColors(64);
button.quantize();
// Save to file
cout << "Writing to \"button_out.miff\" ..." << endl;
button.compressType( RLECompression );
button.write("button_out.miff");
// Display on screen
// button.display();
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
[解决办法]
应该是没有配置好的缘故,参考http://www.imagemagick.com.cn/install_source.html自动安装配置试试看。
[解决办法]
编译错误也不顺便贴出来。唉!
偶遇到类似问题都是用
“每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。”
的方法解决的。
[解决办法]
计算机组成原理→DOS命令→汇编语言→C语言(不包括C++)、代码书写规范→数据结构、编译原理、操作系统→计算机网络、数据库原理、正则表达式→其它语言(包括C++)、架构……
对学习编程者的忠告:
眼过千遍不如手过一遍!
书看千行不如手敲一行!
手敲千行不如单步一行!
单步源代码千行不如单步对应汇编一行!
单步类的实例“构造”或“复制”或“作为函数参数”或“作为函数返回值返回”或“参加各种运算”或“退出作用域”的语句对应的汇编代码几步后,就会来到该类的“构造函数”或“复制构造函数”或“运算符重载”或“析构函数”对应的C/C++源代码处。
VC调试时按Alt+8、Alt+7、Alt+6和Alt+5,打开汇编窗口、堆栈窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应堆栈、内存和寄存器变化,这样过一遍不就啥都明白了吗。
对VC来说,所谓‘调试时’就是编译连接通过以后,按F10或F11键单步执行一步以后的时候,或者在某行按F9设了断点后按F5执行停在该断点处的时候。
[解决办法]
VS IDE中,在不明白的符号上点鼠标右键,选转到定义。