Fwd: GCC can't find header files

Daniel Ericsson deric at macports.org
Sat Mar 3 12:47:58 PST 2012


On 3 mar 2012, at 20:48, Ryan Schmidt wrote:

> On Mar 3, 2012, at 10:38, Miguel Lacerda wrote:
> 
>> I am trying to compile source code that I downloaded from a developer's website. I have installed the lastest version of MacPorts (after installing Xcode 4.3) and port installed cmake and gcc46 as required. Cmake completes without any errors. However, it seems that the compiler is unable to find standard header files (e.g. string.h, stdio.h, etc) when I issue the "make" command (see error messages below). I have checked that /opt/local/include is in my path
> 
> If you're talking about the $PATH environment variable, then it only contains paths to executable programs; it does not have anything to do with paths to libraries or include files (headers).

Ryan is right here even though I think Cmake, if I remember correctly, searches the PATH as well when building it's Makefile. The two environment variables that actually do affect header search paths when compiling are C_INCLUDE_PATH and CPLUS_INCLUDE_PATH.

> This file is on my Snow Leopard system as /usr/include/string.h. Is it there on your system? If not, have you installed the Xcode command line tools? If not, do so.

When you find the headers I'm fairly certain you might need to add the path they're at to the environment variables above if there is any dependency being built as part of the project, as Ryan says above you should find them in "/usr/include".

-- Daniel



More information about the macports-users mailing list