【发布时间】:2010-07-21 12:45:36
【问题描述】:
我已经通过 GCC 在 Mac 上成功编译了一个 C 程序,并直接从源代码安装了 GD2 库。现在我正在尝试使用通过 MacPorts 安装的 GD2 库来执行此操作,并收到以下错误消息:
plotgeometry.c:5:16: error: gd.h: No such file or directory
plotgeometry.c: In function 'PlotGeometry':
plotgeometry.c:28: error: 'gdImagePtr' undeclared (first use in this function)
plotgeometry.c:28: error: (Each undeclared identifier is reported only once
plotgeometry.c:28: error: for each function it appears in.)
plotgeometry.c:28: error: expected ';' before 'im'
plotgeometry.c:29: warning: ISO C90 forbids mixed declarations and code
plotgeometry.c:748: error: 'im' undeclared (first use in this function)
plotgeometry.c:748: warning: implicit declaration of function 'gdImageCreate'
plotgeometry.c:752: warning: implicit declaration of function 'gdImageColorAllocate'
plotgeometry.c:780: warning: implicit declaration of function 'gdImageSetPixel'
plotgeometry.c:801: warning: implicit declaration of function 'gdImagePng'
plotgeometry.c:809: warning: implicit declaration of function 'gdImageDestroy'
我想,我需要为 GCC 提供 GD2 库的路径。 gd.h 位于以下目录中
$ find /opt/local/ -name 'gd.h'
/opt/local//include/gd.h
/opt/local//var/macports/software/gd2/2.0.35_7/opt/local/include/gd.h
我已将/opt/local/include 添加到我的$PATH 变量中,但它没有帮助。我是否需要使用该路径到 GCC 的附加参数?
你能帮我解决这个问题吗?
【问题讨论】:
标签: c gcc compiler-construction gd macports