如何阻止 automake 添加 -I.到我的编译行?
如何阻止 automake 添加 -I.到我的编译行?
似乎 automake 或 libtool 对象总是有一个类似于以下内容的编译命令:
g++ -DHAVE_CONFIG_H -I. -I./proj/otherdir -o myprog.o myprog.c
问题是我有两个同名的头文件....
./proj/otherdir/Header.h
./proj/thisdir/Header.h
每个头都有一个名为 Header 的类,尽管每个头都位于不同的命名空间中。因此,当我在 ./proj/thisdir 中构建时,“-I”。被包含在内,我无法到达 ./proj/otherdir 中的标题,
我不知道如何摆脱最初的“-I”。出现。
有什么提示吗?
谢谢 陈兹
How do I stop automake from adding -I. to my compile line?
It seems automake or libtool objects always have a compile command similar to:
g++ -DHAVE_CONFIG_H -I. -I./proj/otherdir -o myprog.o myprog.c
The problem is that I have two header files with the same name....
./proj/otherdir/Header.h
./proj/thisdir/Header.h
Each header has a class named Header, although each is in a different namespace. So when I am building in ./proj/thisdir, the "-I." gets included and I can't get to the header in ./proj/otherdir
I don't know how to get rid of that initial "-I." that appears.
Any hints?
Thanks
Chenz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您所要做的就是在 Makefile.am 中设置
,然后一切就都很好了。
陈兹
all you have to do is set in the Makefile.am
and then all is good in the world.
Chenz
如果我编写时您的 API 包含不同的标头,
那么该 API 就会变得混乱且容易出错。
为什么不像
and
那样定义您的 API然后,如果需要,您甚至可以引用同一源文件中的两个标头。只需阅读 include 行,您就会知道它实际包含的内容。
If your API includes different headers when I write
that makes that API confusing and error prone.
Why not define your API like
and
Then you could even refer to both headers in the same source file if required. And you would know just from reading the include line what it actually includes.
查看您的应用程序的configure.ac或configure.in,应该在那里
Look in the configure.ac or configure.in for your app, should be in there
它不会删除 -I.,但您可以将相对路径放入
#include
指令中:It doesn't get rid of -I., but you can put relative paths in your
#include
directives: