I am trying to get the sample code provided in libjpeg. i am getting some linker errors.
I followed the instructions provided in the following site
Compile LibJPEG
But i keep getting this linker error. The followin is my code
Can anyone tell me where i have gone wrong?Code:#include <stdio.h> extern "C" { #include "jpeglib.h" } #include <setjmp.h> #include <stdlib.h> extern JSAMPLE *image_buffer; /* Points to large array of R,G,B-order data */ int image_height = 576; /* Number of rows in image */ int image_width = 768; /* Number of columns in image */ GLOBAL(void) write_JPEG_file (char * filename, int quality) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; FILE * outfile; JSAMPROW row_pointer[1]; int row_stride; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); if ((outfile = fopen(filename, "wb")) == NULL) { fprintf(stderr, "can't open %s\n", filename); exit(1); } jpeg_stdio_dest(&cinfo, outfile); cinfo.image_width = image_width; /* image width and height, in pixels */ cinfo.image_height = image_height; cinfo.input_components = 3; /* # of color components per pixel */ cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, quality, TRUE); jpeg_start_compress(&cinfo, TRUE); row_stride = image_width * 3; while (cinfo.next_scanline < cinfo.image_height) { row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride]; (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); } jpeg_finish_compress(&cinfo); fclose(outfile); jpeg_destroy_compress(&cinfo); } int main() { write_JPEG_file("my_bitmap.bmp",3); return 0; }



LinkBack URL
About LinkBacks


