在编译zxing cpp的时候报错:
错误 14 error LNK2005: public: static unsigned int const zxing::DecodeHints::CHARACTER_SET (?CHARACTER_SET@DecodeHints@zxing@@2IB) 已经在 AztecReader.obj 中定义 DecodeHints.obj
解决方法如下:
1、将decodeHints.cpp中的const DecodeHintType DecodeHints::CHARACTER_SET;改为const DecodeHintType DecodeHints::CHARACTER_SET = 1 << 30;
2、将decodeHints.h中的static const DecodeHintType CHARACTER_SET = 1 << 30;改为 static const DecodeHintType CHARACTER_SET;
错误14 error LNK2005: "private: static int const zxing::pdf417::detector::LinesSampler::BARCODE_START_OFFSET" (?BARCODE_START_OFFSET@LinesSampler@detector@pdf417@zxing@@0HB) 已经在 LinesSampler.obj 我还报了几个错误除了BARCODE_START_OFFSET还有MODULES_IN_SYMBOL、BBARS_IN_SYMBOL、POSSIBLE_SYMBOLS,所以我修改如下(你可以根据自己的错误自行修改):
1、将LinesSampler.cpp中的const int LinesSampler::MODULES_IN_SYMBOL;改为const int LinesSampler::MODULES_IN_SYMBOL = 17;
const int LinesSampler::BARS_IN_SYMBOL;改为const int LinesSampler::BARS_IN_SYMBOL = 8;
const int LinesSampler::POSSIBLE_SYMBOLS;改为const int LinesSampler::POSSIBLE_SYMBOLS = 2787;
const int LinesSampler::BARCODE_START_OFFSET;改为const int LinesSampler::BARCODE_START_OFFSET = 2;
2、
将LinesSampler.h中的static const int MODULES_IN_SYMBOL = 17;改为static const int MODULES_IN_SYMBOL;
将static const int BARS_IN_SYMBOL = 8;改为static const int BARS_IN_SYMBOL;
将static const int POSSIBLE_SYMBOLS = 2787;改为static const int POSSIBLE_SYMBOLS;
将static const int BARCODE_START_OFFSET = 2;改为static const int BARCODE_START_OFFSET;
解决上面的错误之后还报:错误14 error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用
报这个错误很简单处理,原因是因为没有main函数作为入口导致的,你自己新建一个cpp文件然后写一个main函数。
网友评论