Automake: How to use a header from one library in a another library in a sister directory

醉酒当歌 提交于 2019-12-11 19:28:18

问题


My directory set up:

libone
  one.c
  one.h
  Makefile.am

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

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

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.


回答1:


Either do it the quick'n'dirty way

#include "../libone/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>

and in your Makefile.am

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


来源:https://stackoverflow.com/questions/13088365/automake-how-to-use-a-header-from-one-library-in-a-another-library-in-a-sister

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!