编译gd-2.0.35.tar.gz时报错:
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/jpeg/include -g -O2 -MT gd_png.lo -MD -MP -MF .deps/gd_png.Tpo -c gd_png.c -fPIC -DPIC -o .libs/gd_png.o
gd_png.c:16:53: error: png.h: No such file or directory
gd_png.c:47: error: expected specifier-qualifier-list before ‘jmp_buf’
gd_png.c:54: error: expected ‘)’ before ‘png_ptr’
gd_png.c:82: error: expected ‘)’ before ‘png_ptr’
gd_png.c:92: error: expected ‘)’ before ‘png_ptr’
解决办法:
vi gd_png.c
将
#include “png.h”
替换成:
#include “/usr/local/libpng/include/png.h”
然后再make就可以了
注:include“”双引号里包含的是libpng安装的路径里的include文件夹里的png.h文件
本文解决在编译GD库时遇到的GCC错误,通过替换包含png.h文件的路径,成功解决了编译问题。具体操作为在vigd_png.c文件中,将双引号内的路径更改为libpng安装目录下的include文件夹路径。

被折叠的 条评论
为什么被折叠?



