1

From the docs:

CPATH specifies a list of directories to be searched as if specified with -I, but after any paths given with -I options on the command line. This environment variable is used regardless of which language is being preprocessed.

On my machine, I'd like to e.g. cross-compile or, otherwise have an versioned set of alternative includes. I'd like to use those to compile other people's code.

Concretely, I have several different versions of python, and their related Python.h files.

$ python setup.py pillow fails because the include it finds first isn't the one needed. (/usr/local/include has an old Python.h, but I need /usr/local/include/Python2.7 to "win").

Adding /usr/local/include/Python2.7 to CPATH (or C_INCLUDE_PATH) doesn't work because it's placed later.

As far as I can see, this isn't python-specific -- surely there's a way to force GCC to have paths prior to -I / CPATH?

1
  • export CC="gcc -I/my/path" Commented Jul 7, 2013 at 8:52

1 Answer 1

1

Its a bit hacky, but you can add it to your compiler var

Makefile syntax

 CC = gcc -Ipath 

Or

 export CC="gcc -Ipath" 

Or g++ for the CXX variable.

Sign up to request clarification or add additional context in comments.

1 Comment

Hacky indeed, but I agree it would work. Seems quite weird for there not to just be a switch analogous to -I. :-/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.