日期:2014-05-16  浏览次数:20736 次

Linux系统中的文件包含问题。
假设在文件夹myh中,有my_class.h,my_student.h,my_grade.h;
my_grade.h

#include "myh/my_class.h"
#include "myh/my_student.h"

这样怎么使编译的时候没有问题。

我知道的一种做法是把 #include "myh/my_class.h"改为#include "my_class.h";

还有没有其他方法?请各位高手指点。
linux

------解决方案--------------------
没有看太明白意思。

对于头文件,除了在include时,把路径带上,还可以在编译的时候指定 -I./myh
------解决方案--------------------
引用:
没有看太明白意思。

对于头文件,除了在include时,把路径带上,还可以在编译的时候指定 -I./myh


+1

编译时使用形如以如下的命令:
gcc -Wall -I . -I ./myh  my.c -o my_prog
------解决方案--------------------
 大写的i,不是小写的L
------解决方案--------------------
gcc -Wall -l ./myh my.c - o my_prog