gpt4 book ai didi

ubuntu - 在 ubuntu 的代码块中编译 Libxml2 时出错

转载 作者:行者123 更新时间:2023-12-04 19:21:30 26 4
gpt4 key购买 nike

我正在将我的 Windows 控制台应用程序移植到 Linux(Ubuntu 12.04)。我正在使用 GNU GCC 编译器来编译我的应用程序。但是我似乎无法摆脱一些错误,这段代码确实在带有 libxml2 的 Windows 中起作用,但无法在此处编译。

在我的构建选项中,我包含搜索路径 usr/include/libxml2。当我编译时,我仍然收到错误:

    Datadictionary.c|| undefined reference to `xmlCheckVersion'|
Datadictionary.c|| undefined reference to `xmlStrcmp'|
Datadictionary.c|| undefined reference to `xmlGetProp'|
Datadictionary.c|| undefined reference to `xmlReadFile'|

现在我到处找,但找不到解决方案。

请帮忙。

最佳答案

你需要安装
sudo apt-get install libxml2sudo apt-get install libxml2-devsudo apt-get install libxslt-devsudo apt-get install xml-core
然后你需要设置编译器选项 - 我/usr/include/libxml2
和链接器选项 -lxml2 -lm

并使用# include<libxml/parser.h> instead #include "libxml/parser.h"
您还需要清除所有以前的搜索路径设置

关于ubuntu - 在 ubuntu 的代码块中编译 Libxml2 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17420628/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com