在生成文件中指定库路径
Specifying Library paths in Makefile
我正在为一个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 或自动conf文件,以便 g++ 在/usr/include/<library-name>
中正确查找库?
在我的 Makefile.am 中,我有以下行来添加 g++ 参数:
AM_CPPFLAGS = -I$(top_srcdir)/src/include/ --std=c++0x
我认为你需要这样的东西:
AM_CPPFLAGS = `pkg-config --cflags libxml-2.0`
因此,您也不必担心包含物位于另一个系统上的位置。
相关文章:
- 如何将更多文件夹添加到c++include路径
- 从函数角度看ID到文件路径的内部与外部映射
- 在C++中设置基于操作系统的文件路径
- C++17 文件系统::remove_all 带有通配符路径
- 从 C 中的变量获取文件的路径,C++
- 将共享库的搜索路径更改为生成文件中提供的 rpath
- 修改生成文件以简化框架 #include 路径
- 将Visual Studio Code路径设置为.clang_format文件
- Windows 非 ASCII 文件路径
- 非 ASCII 文件路径窗口
- C++和带有国家符号的文件路径(也许用 UTF8 编码)
- 获取 H5::D ataSet 的hid_t和文件中的路径以使用 H5OCopy
- 在特定 Unicode 路径中创建文件
- 如何让用户在 tinyxml2 中输入 XML 文件的路径
- 如何将COM .tlb文件导入具有相对路径C++文件中?
- C++ 路径文件存在限制为 260 个字符
- QT-在pro中指定DLL路径.文件
- 路径文件存在导致链接器错误 2028/2019
- 选择QTableWidgetItem qt的路径文件
- 如何有一个正确的路径文件读取它到stringstream