【发布时间】:2016-11-09 10:17:31
【问题描述】:
我使用的是 64 位 Windows 10 操作系统。我从 JPEG 网站下载了 jpegsr9b 库,用于读取 JPEG 头文件。我用 C 编写了程序来读取 JPEG 文件,如下所示:
#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
但它给出了错误
在 demo.c:2:0 包含的文件中: jpeglib.h:25:62:致命错误:jconfig.h:没有这样的文件或目录 编译终止。
如何解决问题?
【问题讨论】:
-
在与您放置
<jpeglib.h>相同的位置,您必须安装jpeg lib 的所有其他头文件。您必须将此路径添加到您的包含 [环境] 变量/makefile。编译器/链接器还必须知道在哪里可以找到 jpeg.lib。