0

我正在尝试使用 MinGW 构建 zxing,但它失败并出现错误undefined reference to libiconv_close

这是构建的输出:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build\zxing.exe -Ldl -L/usr/lib -LC:/MinGW/msys/1.0/local/lib -liconv build\magick\src\MagickBitmapSource.o build\magick\src\main.o build\libzxing.a -lMagick++ -lMagickWand -lMagickCore
build\libzxing.a(Decoder.o): In function `add':
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/aztec/decoder/Decoder.cpp:51: undefined reference to `libiconv_open'
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/aztec/decoder/Decoder.cpp:52: undefined reference to `libiconv'
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/aztec/decoder/Decoder.cpp:53: undefined reference to `libiconv_close'
build\libzxing.a(DecodedBitStreamParser.o): In function `ZN5zxing6qrcode22DecodedBitStreamParser6appendERSsPKhjPKc':
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp:70: undefined reference to `libiconv_open'
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp:85: undefined reference to `libiconv'
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp:87: undefined reference to `libiconv_close'
C:\Workspace\BarCodes\zxing-2.1\cpp/build/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp:92: undefined reference to `libiconv_close'
collect2: ld returned 1 exit status
scons: *** [build\zxing.exe] Error 1
scons: building terminated because of errors.
4

1 回答 1

0

正如@Mat 所说,问题在于链接顺序,-liconv需要在命令行中进行。build\libzxing.a

于 2012-11-15T13:44:36.267 回答