Search code examples
gccinclude-path

How do you include header files with absolute paths from the home directory?


Happy New Year Everybody,

I am struggling with a rather stupid gcc include problem. I tried to change my working relative include paths (using -I) to absolute paths, so that I could move the source files and it would still compile.

Relative path (working):

-I../../../NVIDIA_GPU_Computing_SDK/OpenCL/common/inc -lOpenCL

Absolute path (not working):

-I~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc -lOpenCL

So how do you inlcude header files with absolute paths from the home directory?

Thanks

[update]

I tried the $HOME idea with -I$HOME/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc but the output of the make file says:

gccIOME/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc-lOpenCL -O3 -fno-strict-aliasing -fopenmp -std=c99 -lm -D_GNU_SOURCE -Wall -pedantic foo.c foo.c:14: fatal error: CL/cl.h: No such file or directory compilation terminated.

Does it make a difference that I use a make file for these parameters?


Solution

  • Specify the full path or $HOME instead of using ~ for the home directory