错误 14 error LNK2005: public: static unsigned int const zxing::DecodeHints::CHARACTER_SET (?CHARACTER

在编译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 BARS_IN_SYMBOL = 8;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函数。


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

修炼之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值