【发布时间】:2021-12-17 19:11:27
【问题描述】:
我有 C 项目,分为 Z 模块。每个模块都有自己的子文件夹,其中 /inc/ 用于头文件,/src/ 用于 src 文件。如图所示:
Zth_Module.c 包含来自其他各种模块的文件:
/*In Zth_Module.c*/
#include "first.h"
#include "second.h"
#include "third.h"
如果在makefile中使用-I,如何给出每个子目录的路径? 它显示致命错误:Timer.h: No such file or directory for include file first.h or second.h which are in other subdirectories.
提供搜索所有 *.h 文件的路径的方法是什么?
【问题讨论】:
-
-I/path/to/inc/of/first -I/path/to/inc/of/second等等..这样它应该可以工作。