1

I am having 64 bit Windows 10 operating system. I have downloaded jpegsr9b library from JPEG website which is used for reading JPEG header file. I have written program in C to read JPEG file as below:

#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);
}

Then compiled as

gcc demo.c -ljpeg

But it gives error

In file included from demo.c:2:0: jpeglib.h:25:62: fatal error: jconfig.h: No such file or directory compilation terminated.

How to solve the problem?

Melebius
  • 6,183
  • 4
  • 39
  • 52
user6667312
  • 19
  • 1
  • 5
  • In the same place as where you placed `` you must install all the other header files of the jpeg lib. You must add this path to your include [environment] variables/makefile. The compiler/linker must also know where to find jpeg.lib. – Paul Ogilvie Nov 09 '16 at 10:55

1 Answers1

1

install the binary from here and then include the include folder from the installation in visual studio.

for more instruction follow this answer.

Sumsuddin Shojib
  • 3,583
  • 3
  • 26
  • 45