安装gd库出错:AM_ICONV AM_ICONV

# make && make install

configure.ac:64: error: possibly undefined macro: AM_ICONV

make: *** [configure] 错误 1

把报错信息“configure.ac:64: error: possibly undefined macro: AM_ICONV,得到“But you need to have gettext”没有gettext这个包。


http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz

tar xzfgettext-0.18.1.1.tar.gzcdgettext-0.17
./configure
make && make install

 

 

 

 

 

如果在使用pugixml解析xml文件时,确定了xml文件的编码格式为UTF-8,但是在解析时还是出现中文乱码的情况,可以尝试以下几个方法: 1. 确认xml文件中的中文字符是否是UTF-8编码,如果不是,需要将其转换为UTF-8编码。 2. 如果在解析过程中仍然出现中文乱码,可以尝试在load_file函数中使用pugi::encoding_auto参数: ``` pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file("example.xml", pugi::parse_default, pugi::encoding_auto); ``` 3. 如果上述方法无效,可以尝试使用iconv将xml文件转换为UTF-8编码,然后再解析: ``` #include <iconv.h> #include <iostream> #include <fstream> #include <sstream> #include <string.h> #include "pugixml.hpp" int main() { std::ifstream ifs("example.xml"); std::stringstream buffer; buffer << ifs.rdbuf(); std::string str = buffer.str(); iconv_t cd = iconv_open("UTF-8", "GB2312"); char* inbuf = (char*)str.c_str(); size_t inlen = str.length(); size_t outlen = inlen * 4; char* outbuf = new char[outlen]; char* ptmp = outbuf; memset(outbuf, 0, outlen); iconv(cd, &inbuf, &inlen, &outbuf, &outlen); iconv_close(cd); std::string utf8str(ptmp); delete[] ptmp; pugi::xml_document doc; pugi::xml_parse_result result = doc.load_string(utf8str.c_str()); if (result) { std::cout << "Load xml file success!" << std::endl; } else { std::cout << "Load xml file failed!" << std::endl; } return 0; } ``` 上述代码中使用iconv将xml文件转换为UTF-8编码,然后再使用pugixml解析xml文件。 希望这些方法可以帮助你解决中文乱码的问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值