How to specify include directory for configure scr

2020-05-23 03:48发布

I have a linux system at my workplace with pretty old packages and no root access. I'm compiling packages that I need from source with --prefix=[somewhere in homedir]. My problem is that I just can't find out how to convince configure to look for header files in a specific directory. The source is cpp. I tried with environment variables related to g++ and looking up flags and googling but I had no success. Can someone help me solve this?

4条回答
Animai°情兽
2楼-- · 2020-05-23 03:54

The normal way to do this is --with-<feature>=<header directory>.

查看更多
仙女界的扛把子
3楼-- · 2020-05-23 04:01
CPPFLAGS = C Preprocessor Flags, these flags will be used for C and C++ compilation.

CFLAGS = C Flags, these flags will be used when compiling C.

CXXFLAGS = C++ Flags, these flags will be used when compiling C++.

The -I flag specifies an additional include directory to be used during compilation.

Generally it's a good idea to use CPPFLAGS when specifying include directories, that way you know it will be used even if the project has some source that is compiled as C.

Of course, there might also be circumstances where you only want the include directory to be used by C or C++, but not both. In which case you would obviously be better served by using CFLAGS or CXXFLAGS instead.

查看更多
4楼-- · 2020-05-23 04:06

Usually you can pass additional compiler flags inside CXXFLAGS. For gcc you can specify more include directories with -I/some/dir, e.g.

$ ./configure CXXFLAGS="-I/some/dir/"

where /some/dir/ contains your headers.

查看更多
放荡不羁爱自由
5楼-- · 2020-05-23 04:10

It's better to use CPPFLAGS to specify include directories.

./configure CPPFLAGS="-I/your/whatever/includedir"
查看更多
登录 后发表回答