I'm new to this. I use Linux and gcc in bash .
There is:
p1.c:
int func() { return 1889; }func.h:
#ifndef ONCE #define ONCE int func(); #endifp2.c:
#include <stdio.h> #include <func.h> int main() { int a = func(); printf("%d",a); return 0; }
func.h I specifically moved to another folder. In *.bashrc* added export PATH="$PATH:/root/deleteme/spec"
# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/root/deleteme/spec # gcc p?.c conclusion:
p2.c:2:18: fatal error: func.h: No such file or directory #include <func.h> ^ compilation terminated.
Earned by specifying gcc -I .
Why doesn't it work through the environment variable? I want to figure out how it works. Thank :)