编译gd-2.0.35.tar.gz时报错:gd_png.c:16:53: error: png.h: No such file or directory

时间:2023-02-03 22:51:22

编译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文件

转自:http://hi.baidu.com/wainqaidcz/blog/item/bfc5fa53749356481138c277.html