解释c中的头文件路径

时间:2022-09-10 15:09:08

I have a headerpath in a c program that reads

我在读取的c程序中有一个标题路径

#include <lib/a.h>
#include <lib/b.h>

How do I specify where 'lib' should be in my makefile? It gives me a compile error saying lib/a.h is not found. But I know the system path where a.h is located. How do I tell my Makefile where to go find lib?

如何在makefile中指定'lib'应该在哪里?它给我一个编译错误,说找不到lib / a.h.但我知道a.h所在的系统路径。如何告诉我的Makefile去哪里找lib?

Thanks, Vik.

1 个解决方案

#1


5  

Add an argument -I/path/to/include to the compilation flags (e.g., CFLAGS or CXXFLAGS) where the path leads to the parent directory of the lib directory.

将参数-I / path /添加到/ include到编译标志(例如,CFLAGS或CXXFLAGS),其中路径指向lib目录的父目录。

#1


5  

Add an argument -I/path/to/include to the compilation flags (e.g., CFLAGS or CXXFLAGS) where the path leads to the parent directory of the lib directory.

将参数-I / path /添加到/ include到编译标志(例如,CFLAGS或CXXFLAGS),其中路径指向lib目录的父目录。