I need JPEG handling capabilities in my project so I decided to use jpeg-8d library, after downloading packages I’ve made usual ./configure; make and make install. make test returns no errors and no problems was reported during the whole process but when I opened example.c in Code Blocks 10.05 compilation failed. I’ve “googled” some solutions and added
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
In jpeglib.h file, recompiled, then added these lines to linker section of code blocks:
/usr/local/lib/libjpeg.a
/usr/local/lib/libjpeg.so
also added according directories into directories section.
but compiler still fails to compile example.c, here are some of the errors:
> /home/raff/CodeBlocks/jpeg-8d/example.c|116|warning: incompatible implicit declaration of built-in function ‘exit’|
> example.c|| undefined reference to 'image_width'
> example.c|| undefined reference to 'image_height'
If anyone successfully installed and used jpeg library please help, I have no problem in switching IDE and/or linux distribution.
Your instalation of the library seems to be fine (otherwise it would complain about missing
jpeglib.hduring compilation)The file
example.cis supposed to be part of documentation, not a code you can compile and use. Note that there’s nomain(), for example. You should use it as a reference on how to code methods for compressing and decompressing jpeg files.The variables
image_widthandimage_height(andimage_buffer) are declared asextern, so they are assumed to be defined in some other file. You can write your program defining those variables and filling up the buffer and only after that you can use the provided methods (write_JPEG_fileandread_JPEG_file).