easyMule-VeryCD-src---VS2010调试笔记

本文记录了在Windows 7 32位英文版上使用VS2010 SP1编译easyMule-VeryCD源码时遇到的错误及解决方案。主要涉及C2440、C2664错误,以及编译后的资源文件路径问题。通过修改源码和项目设置,成功解决了编译和链接问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用的系统是win7 32位英文版,VS2010-sp1英文版。电驴的代码大概是10年10月份下载的。

 

首先编译所要用的库。

 

1. error C2440: 'initializing' : cannot convert from 'int' to 'const unsigned char *'。

错误在文件utility(163)中,这个是编译环境提供的文件。这种错误一般是由模板实例化所引起的参数不匹配造成,因该在后面的错误中改正。

错误定位在下面这条语句:

return HashIdentifier(NULL, 0);

引起错误的原因是在map中引入了c++ 0x的新特性,右值引用,而导致的参数演绎后类型不匹配。

修改:

return HashIdentifier((byte*)NULL,(unsigned int) 0);

为啥要这样强制转换是因为下面

typedef std::pair<const byte *, unsigned int> HashIdentifier;

 

(查了一下,最新版的cryplib库可以在Vs2010中编译通过,解决问题的方法和上面的一样)

 

2.  error C2664: 'CryptoPP::AllocatorWithCleanup<T>::AllocatorWithCleanup(const CryptoPP::AllocatorWithCleanup<T> &)' : cannot convert parameter 1 from 'CryptoPP::AllocatorWithCleanup<T>' to 'const CryptoPP::AllocatorWithCleanup<T> &'

这个是由于secblock.h缺少一个类型转换构造函数引起的。查阅了cryptlib的最新版本,发现增加了很多东西。其中有下面语句:

 

 

    template <class U> struct rebind { typedef AllocatorWithCleanup<U, T_Align16> other; };

#if _MSC_VER >= 1500  //表示编译器版本大于或等于1500

AllocatorWithCleanup() {}

template <class U, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<U, A> &) {}

#endif

上面进行了CryptoPP::AllocatorWithCleanup<CryptoPP::HuffmanDecoder::CodeInfo,0> 

CryptoPP::AllocatorWithCleanup<std::_Container_proxy,0>

的类型转换。

修改:</

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值