我的项目需要 JPEG 处理能力,所以我决定使用 jpeg-8d 库,在下载我常用的包后./configure; make and make install
。make test
整个过程没有返回任何错误并且没有报告任何问题但是当我example.c
在Code Blocks 10.05中打开时编译失败。我已经“搜索”了一些解决方案并添加了
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
在jpeglib.h
文件中,重新编译,然后将这些行添加到代码块的链接器部分:
/usr/local/lib/libjpeg.a
/usr/local/lib/libjpeg.so
也将相应的目录添加到目录部分。但编译器仍然无法编译 example.c,以下是一些错误:
> /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'
如果有人成功安装和使用 jpeg 库请帮忙,我在切换 IDE 和/或 linux 发行版时没有问题。