Using Macports libraries in Xcode gcc
Ryan Schmidt
ryandesign at macports.org
Wed Jan 14 15:52:40 PST 2009
On Jan 13, 2009, at 03:32, Neil wrote:
> My .bash_profile :
> # Add MacPorts directories, if they exist.
> if [ -d /opt/local ]; then
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> export MANPATH=/opt/local/share/man:$MANPATH
> export C_INCLUDE_PATH=/opt/local/include
> export CPLUS_INCLUDE_PATH=/opt/local/include
> alias gcc="gcc -I/opt/local/include -L/opt/local/lib"
> alias g++="g++ -I/opt/local/include -L/opt/local/lib"
> # if [ -f /opt/local/etc/bash_completion ]; then
> # . /opt/local/etc/bash_completion
> # fi
> fi
>
> IIRC, C_INCLUDE_PATH/CPLUS_INCLUDE_PATH alone didn't work, and thus I
> added the aliases. But now that I think about it, I should be able to
> remove the former and the later should do everything on it's own. I'm
> going to try that, I think...
As I understand it, it should be sufficient to set EITHER:
export C_INCLUDE_PATH=/opt/local/include
export CPLUS_INCLUDE_PATH=/opt/local/include
export LIBRARY_PATH=/opt/local/lib
OR:
export CPPFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
It should not be necessary in either case to have gcc or g++ be
aliases to anything.
I'm not sure what the difference is between the above two methods --
if one is preferable, or if they are for different situations, or
what. MacPorts uses the CPPFLAGS / LDFLAGS method internally.
More information about the macports-users
mailing list