开发者社区 问答 正文

makefile 中gcc -I 设置路径的问题

我在当前目录下创建了main.c 跟include目录,然后在include中创建了一个a.h,然后在main.c 中#include,然后在命令中直接输入 gcc -I./include -o myapp main.c 可以正常执行,但是在当前目录下创建makefile文件,在其中输入:

myapp: main.c a.h

gcc -I./include -o myapp main.c

然后make,就会报告说找不到头文件a.h,求问怎么回事?我用的是ubuntu13.10

展开
收起
a123456678 2016-06-14 10:35:17 2882 分享 版权
1 条回答
写回答
取消 提交回答
  • 应该是
    
    myapp: main.c ./include/a.h
    
        gcc -I./include -o myapp main.c
    2019-07-17 19:36:56
    赞同 展开评论
问答分类:
问答地址: