Automake:如何使用姐妹目录中另一个库中一个库的标头 [英] Automake: How to use a header from one library in a another library in a sister directory

查看:143
本文介绍了Automake:如何使用姐妹目录中另一个库中一个库的标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录已设置:

libone
  one.c
  one.h
  Makefile.am

libtwo
  two.c #includes one.h
  two.h
  Makefile.am

...
Makefile.am
configure.ac
...

现在,当我执行autoreconf -fvi并进行配置和制作时, 我从two.c中收到错误:找不到one.h. 如何在Makefile.am中设置包含路径? 任何帮助表示赞赏.

Now when I do autoreconf -fvi and configure and make, I get the error from two.c: could not find one.h. How do I setup the include paths in Makefile.am's? Any help appreciated.

推荐答案

都可以通过肮脏"的方式快速完成

Either do it the quick'n'dirty way

#include "../libone/one.h"

或(首选,因为那样安装one.h或在源代码树中还是将其拆分为另一个项目都没有关系)

or (preferred, because then it doesn't matter whether one.h is installed or in the source tree or split out into a different project)

#include <libone/one.h>

和您的Makefile.am

libtwo_a_SOURCES = two.c two.h
libtwo_a_CPPFLAGS = -I$(top_srcdir)

这篇关于Automake:如何使用姐妹目录中另一个库中一个库的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆