2012-11-01 43 views
0

我试图建立使用MinGW的斑马线,但它失败,错误undefined reference to libiconv_close未定义的参考`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. 
+0

我们可以看到你的SCons构建脚本吗? – Brady

+0

我对libiconv一无所知,但你确定你正在链接到正确的版本吗?这可能会导致类似这样的问题,如果旧版本没有相同的符号... – Xymostech

+1

'-liconv'需要在链接命令中的zxing存档之后。 – Mat

回答

0

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