我已在我的计算机上安装了Imlib2,但是如下所示执行示例程序(更改了加载文件的行以包含错误代码)我一直收到错误代码4.
/* standard headers */
#include <X11/Xlib.h>
#include <Imlib2.h>
#include <stdio.h>
#include <string.h>
/* main program */
int main(int argc, char **argv)
{
/* an image handle */
Imlib_Image image;
Imlib_Load_Error err;
/* if we provided < 2 arguments after the command - exit */
if (argc != 3) exit(1);
/* load the image */
image = imlib_load_image_with_error_return(argv[1],&err);
if(err) printf("load error:%d",err);
/* if the load was successful */
if (image)
{
char *tmp;
imlib_context_set_image(image);
tmp = strrchr(argv[2], '.');
if(tmp)
imlib_image_set_format(tmp + 1);
imlib_save_image(argv[2]);
}
}