我正在尝试使用Visual Studio 2015在Windows 7(64)上编译zxing library ported to C++。
我使用Cmake遵循自述文件中描述的步骤来生成.sln和.vcxproj文件。
但是,当我构建代码时,出现此错误:
在此行:
iconv(ic, &ss, &sl, &ds, &dl);
这是发生错误的部分代码:
#include <zxing/aztec/decoder/Decoder.h>
#ifndef NO_ICONV
#include <iconv.h>
#endif
#include <iostream>
#include <zxing/FormatException.h>
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
#include <zxing/common/reedsolomon/ReedSolomonException.h>
#include <zxing/common/reedsolomon/GenericGF.h>
#include <zxing/common/IllegalArgumentException.h>
#include <zxing/common/DecoderResult.h>
using zxing::aztec::Decoder;
using zxing::DecoderResult;
using zxing::String;
using zxing::BitArray;
using zxing::BitMatrix;
using zxing::Ref;
using std::string;
namespace {
void add(string& result, char character) {
#ifndef NO_ICONV
char character2 = character & 0xff;
char s[] = {character2};
char* ss = s;
size_t sl = sizeof(s);
char d[4];
char* ds = d;
size_t dl = sizeof(d);
iconv_t ic = iconv_open("UTF-8", "ISO-8859-1");
iconv(ic, &ss, &sl, &ds, &dl); //<<<< at this line
iconv_close(ic);
d[sizeof(d)-dl] = 0;
result.append(d);
#else
result.push_back(character);
#endif
}
...
谢谢你的帮助!
最佳答案
这是iconv的签名:
size_t iconv (iconv_t cd,
const char* * inbuf, size_t * inbytesleft,
char* * outbuf, size_t * outbytesleft);
但是您使用
iconv
作为第二个参数而不是char*
来调用const char**
。Here is a complete example。
关于c++ - Libconv编译Zxing时无法转换参数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36625993/