描述 makefile 中的头文件位置
在我正在开发的一个新项目中,我有以下目录结构:
Project_base
|---- src
|---- bin
|---- h
| Makefile
在我的源文件中,我包含如下所示的内容:
#include "../h/SomeHeaderFile.h"
而不是更正确的形式:
#include "SomeHeaderFile.h"
我需要在我的 makefile 中添加什么,以便我可以删除包含相对路径,这样它们看起来就会正常?
ADDITION: also, where do I set this in CDT (C++ for eclipse) so that in design time this is reflected as well?
In a new project I am working on I have the following dir structure:
Project_base
|---- src
|---- bin
|---- h
| Makefile
And in my source files I have includes that look like so:
#include "../h/SomeHeaderFile.h"
instead of the more correct form:
#include "SomeHeaderFile.h"
What do I need to add to my makefile so that I can removed the relative path includes so they will look normal?
ADDITION: also, where do I set this in CDT (C++ for eclipse) so that in design time this is reflected as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在传递给 gcc 的参数列表中添加
-I../h
。You need to add
-I../h
in the list of parameters you pass to gcc.向 CFLAGS 添加一个标志,以便标头的根目录成为标头搜索路径的一部分:
这样,除了默认标头目录之外,gcc/g++ 也会在此处查找。
Add a flag to your CFLAGS so that the root of the headers is part of the headers search path:
That way gcc/g++ will also look here in addition to the default headers directories.