【发布时间】:2012-12-17 04:24:55
【问题描述】:
我在一个 C++ 项目中使用 autoconf 和 automake,我希望 g++ 足够聪明,可以在我的源代码已经拥有的情况下查看 /usr/include/<library-name>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <curl/curl.h>
#include <openssl/md5.h>
当我刚刚运行 ./configure && make 时,我得到了这个错误
g++ -DHAVE_CONFIG_H -I. -I.. -Wall -O2 -g -O2 -MT azurefs.o -MD -MP -MF .deps/azurefs.Tpo -c -o azurefs.o azurefs.cpp
azurefs.cpp:33:26: fatal error: libxml/xpath.h: No such file or directory
compilation terminated
我必须以这种方式使用CCXXFLAGS 包含库路径
$ CXXFLAGS=-I/usr/include/libxml2 ./configure && make
有没有更好的方法来编写我的代码、Makefile 或 autoconf 文件,以便 g++ 可以在 /usr/include/<library-name> 中正确查找库?
【问题讨论】:
-
有一个更好的方法:
./configure CPPFLAGS=-I/usr/include/libxml2 && make。 (假设您使用的不是古老的 autoconf 版本)
标签: c++ gcc g++ autoconf automake