1
我有64位Windows 10操作系统。我从JPEG网站下载了用于读取JPEG头文件的jpegsr9b
库。我已经用C编写的程序来读取如下JPEG文件:如何在Windows上安装jpeglib 10
#include<stdio.h>
#include<jpeglib.h>
#include <stdlib.h>
int main()
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
int height,width,pixel_size,colorspace,i,j,k,res;
FILE *infile = fopen("e:/Images/im.jpg", "rb");
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
width = cinfo.output_width;
height = cinfo.output_height;
printf("\nWidth = %d",width);
printf("\nHeight = %d",height);
}
然后编译为
gcc demo.c -ljpeg
但它给错误
In file included from demo.c:2:0: jpeglib.h:25:62: fatal error: jconfig.h: No such file or directory compilation terminated.
如何解决这个问题?
在与放置''的位置相同的位置,您必须安装jpeg库的所有其他头文件。您必须将此路径添加到您的include [环境]变量/ makefile中。编译器/链接器也必须知道在哪里可以找到jpeg.lib。 –