i'm confused about the following include files(with GCC)
i've A.c and B.c in folder AAA
and B.h in folder BBB
in A.c:
#include <stdio.h>
#include "B.h"
main()
{
errPrint();
}
in B.c:
#include <stdio.h>
#include "B.h"
void errPrint(void)
{
printf("err info\n");
}
in B.h:
#ifndef _B_H
#define _B_H
void errPrint(void);
#endif
now i run the command:
#gcc -I /BBB A.c B.c -o exeobj
it's OK. but it seems a little boring that i have to use "-I" to specify header when in other folder. so i edit my "/etc/profile" file and added
C_INCLUDE_PATH=/BBB
export C_INCLUDE_PATH
to specify the header folder, then
echo $C_INCLUDE_PATH
it shows the right route. but when i compile:
#gcc -c A.c B.c
error shows:
error: B.h: No such file or directory
i don't know where went wrong, anybody have clues about it, any suggestions are weclome.
note: i'm a newbie and can't use Makefile yet...