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

本作者使用的  win 32位中文字版 vs2010               电驴代码是  2011.5.28 日在电驴官网下载

首先编译所要用的库。

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>

的类型转换。

修改:

在secbolck.h的103行(template <class U> struct rebind { typedef AllocatorWithCleanup<U> other; };)下面增加如下内容:

#if _MSC_VER >= 1500

AllocatorWithCleanup() {}

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

#endif

编译。。。

晕,还是不行,看看这次的错误,意思是说给AllocatorWithCleanup模板的参数太多了,比较了一下,确实,新版的cryptlib库中,这个模板有两个参数,旧版的就一个。于是将上面的A参数去掉:变为

#if _MSC_VER >= 1500//加在AllocatorWithCleanup 类定义里面 AllocatorWithCleanup() {} template <class U> AllocatorWithCleanup(const AllocatorWithCleanup<U> &) {} //template <class U, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<U, A> &) {} #endif

ok。

3. 接下来的错误来自两个资源库。其实这个错误很简单,就是特别难找。错误的提示大概如下:

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets(113,5): error MSB3073: The command "if not exist ../debug/lang md ../debug/lang

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets(113,5): error MSB3073: copy "E:/My Documents/easyMule-VeryCD-src--win7/src/lang/dynamic/languages - Chinese (Taiwan).dll" ../debug/lang/languages - Chinese (Taiwan).dll

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets(113,5): error MSB3073:

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.

经过坚持不懈的搜索搜索在搜索,还是没找到,最后无意中在工程属性页中发现了这个:(如下图)

看到了没,那个if not啥啥啥的。这个动作实在build之后的事件,而出错的原因就是,链接器成功创建了文件,但是现在却找不到了。这个问题我在另一篇日志里讲过,解决方法是将下图中红框中的内容改成zh_TW(如果是大陆语言,则是zh_CH,注意不能在这加后缀dll,不然还是同样的错误):

到现在,lib库编译都没有问题了,不过有个小问题,我始终没找到解决方法。这个问题是这样,就算我不改动代码,每次build(注意,不是rebuild)的时候,都有下列输出:

1>------ Build started: Project: id3lib, Configuration: Debug Win32 ------

2>------ Build started: Project: cryptlib, Configuration: Debug Win32 ------

1>Build started 2011/4/6 21:24:05.

2>Build started 2011/4/6 21:24:05.

2>InitializeBuildStatus:

2>  Creating "./Debug/cryptlib.unsuccessfulbuild" because "AlwaysCreate" was specified.

1>InitializeBuildStatus:

1>  Creating "./Debug/id3lib.unsuccessfulbuild" because "AlwaysCreate" was specified.

1>ClCompile:

2>CustomBuild:

2>  Performing Custom Build Tools

1>  All outputs are up-to-date.

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(E:/My Documents/easyMule-VeryCD-src--win7/id3lib/libprj/./Debug/id3lib.lib) does not match the Library's OutputFile property value (E:/My Documents/easyMule-VeryCD-src--win7/id3lib/libprj/id3libD.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

1>I:/Program Files/MSBuild/Microsoft.Cpp/v4.0/Microsoft.CppBuild.targets(1153,5): warning MSB8012: TargetName(id3lib) does not match the Library's OutputFile property value (id3libD). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

1>Lib:

1>  All outputs are up-to-date.

1>  id3lib_2005.vcxproj -> E:/My Documents/easyMule-VeryCD-src--win7/id3lib/libprj/./Debug/id3lib.lib

2>ClCompile:

2>  All outputs are up-to-date.

1>BscMake:

1>  All outputs are up-to-date.

1>FinalizeBuildStatus:

1>  Deleting file "./Debug/id3lib.unsuccessfulbuild".

1>  Touching "./Debug/id3lib.lastbuildstate".

1>

1>Build succeeded.

1>

1>Time Elapsed 00:00:00.24

2>  All outputs are up-to-date.

2>  All outputs are up-to-date.

2>Lib:

2>  All outputs are up-to-date.

2>  cryptlib_2005.vcxproj -> E:/My Documents/easyMule-VeryCD-src--win7/crypto51/crypto/./Debug/cryptlib.lib

2>FinalizeBuildStatus:

2>  Deleting file "./Debug/cryptlib.unsuccessfulbuild".

2>  Touching "./Debug/cryptlib.lastbuildstate".

2>

2>Build succeeded.

2>

2>Time Elapsed 00:00:00.27

========== Build: 2 succeeded, 0 failed, 9 up-to-date, 0 skipped ==========

有9个库是没有问题的,但是上面两个始终重新编译,这样会造成编译时间延长。。。很不爽啊。

下面就该编译电驴的代码了。这块我碰到2个错误,一个是编译时,一个在链接时。

1. 第一个错误是说:

1>WorkLayer/UPnP/UPnpMgr.cpp(500): error C2662: 'CUPnpNatMappingKey::Serialize' : cannot convert 'this' pointer from 'const CUPnpNatMappingKey' to 'CUPnpNatMappingKey &'

1>          Conversion loses qualifiers

引发这条错误的代码是:
it -> Serialize(ar);
这个错误说的意思是,没法将常量转换成变量。原因在于set这个容器,set的begin函数在不同的标准库中返回值的类型有一点小区别。有的实现返回const迭代器,而有的返回可修改迭代器。不幸的是,VS2010的stl中,set的begin总是返回的常量迭代器。
根据函数语义,修改如下:

for (it = m_setAddedMapping.begin(); it != m_setAddedMapping.end(); it++) { CUPnpNatMappingKey key(*it); key.Serialize(ar); } ar.Close();  
也就是增加了一个临时变量,让这个可修改的变量来调用Serialize。
2. 第二个问题的错误如下:
 uafxcwd.lib(afxglobals.obj)   error LNK2005: "public: virtual __thiscall CMemDC::~CMemDC(void)" (??1CMemDC@@UAE@XZ) already defined in ProgressCtrlX.obj   
上面是意思是,连接器说,我找到了两个定义,一个在 uafxcwd.lib(afxglobals.obj)里面,还有一个在ProgressCtrlX.obj   。
找了一下,电驴里包含一个MemDC.h文件,里面定义了一个CMemDC类,不巧的是,VS2010的MFC新增了这个类,所以链接时会出问题。
那怎么解决了?有如下办法:
1 修改MFC中CMemDC的名字。这个明显不行。。。
2 将emule中的CMemDC改个名字,这个方法可以,可是我找了下,貌似用这个类的文件还不少。不甘心一条条改,于是想出下面的方法。。。
3 增加一个宏定义,
#define CMemDC XCMemDC
将上面的语句加到stdafx.h的最后。(也可以在工程属性页中以编译器指令的形式定义宏,格式为 /D "CMemDC=XCMemDC")。
经过5天断断续续的找啊改啊,驴子终于跑起来了,至于干不干活就在说吧,哈哈,睡觉!
ps://本人发现的编译问题
  1. 在编译lib的时候 对于语言包编译是没法解决的。使用他的 zh_CH 删除后续.dll 或者不删除都没法解决,最后解决办法手动将debug下面的zh_CH.dll 移动到
  2. 在Pinger.h文件里面发现 类型重定义 解决办法修改为#ifndef HAVE_WIN7_SDK_H typedef struct ip_option_information { u_char Ttl; /* Time To Live (used for traceroute) */ u_char Tos; /* Type Of Service (usually 0) */ u_char Flags; /* IP header flags (usually 0) */ u_char OptionsSize; /* Size of options data (usually 0, max 40) */ u_char FAR *OptionsData; /* Options data buffer */ } IPINFO, *PIPINFO, FAR *LPIPINFO; /* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY * structures, followed by options and the data in ICMP echo reply * datagram received. You must have room for at least one ICMP * echo reply structure, plus 8 bytes for an ICMP header. */ typedef struct icmp_echo_reply { u_long Address; /* source address */ u_long Status; /* IP status value (see below) */ u_long RTTime; /* Round Trip Time in milliseconds */ u_short DataSize; /* reply data size */ u_short Reserved; /* */ void FAR *Data; /* reply data buffer */ struct ip_option_information Options; /* reply options */ } ICMPECHO, *PICMPECHO, FAR *LPICMPECHO; #else typedef ip_option_information FAR *LPIPINFO; typedef ip_option_information IPINFO; #endif
  3. 找不到头文件 WorkLayer/otherfunctions.cpp(26): fatal error C1083: 无法打开包括文件:“atlrx.h”: No such file or directory  解决办法  在电驴讨论网找到 VS 2008(我的是vs2010)中由于将ALT项目的部分代码剥离出去成为了独立的开源项目,需要用到ALT中正则表达式等功能就需要手动下载。
    参考:http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=306398
    下载地址:http://www.codeplex.com/AtlServer (http://www.codeplex.com/AtlServer)
    把下载的东西解压缩到一个目录,比如c:/alt/
    在VS里面[工具]--[选项]--[项目和解决方案]--[VC++目录],在右上角选择[包含引用的文件]中加入c:/alt/include就OK了

编译电驴v1.1.15 with vs2010相关推荐

  1. emule编译 vs2005+win7+最新版本电驴

    基于这篇文章完成编译工作 http://blog.csdn.net/cecilulysess/article/details/4631458 下载最新版电驴 打开emule.sln,点击生成解决方案, ...

  2. CentOS7 安装Mldonkey(电驴)步骤

    CentOS7 安装Mldonkey(电驴)步骤 1.从网上下载压缩包: wget https://sourceforge.net/projects/mldonkey/files/mldonkey/3 ...

  3. Linux下安装与配置aMule电驴

    虽然说Wget已经够速度了,可是缺点是有些链接下不下来,毕竟它不能像迅雷那样疯狂地明目张胆用盗链技术.所以有些时候还是挺苦恼的,得另想办法.个人感觉电驴是不错的选择. Google了一下,好像蛮多评论 ...

  4. 目前还存活的多个电驴下载站点

    0.http://www.emule-project.net/ 这个不用说了,emule官方,没有它就没有下面的所有一切,德国人开的.只提供官方版emule软件,没有资源下载.秉承理念"eM ...

  5. 目前还存活的多个电驴下载站点!电驴达人收藏

    目前还存活的多个电驴下载站点!电驴达人收藏(2011更新) 0.http://www.emule-project.net/ 这个不用说了,emule官方,没有它就没有下面的所有一切,德国人开的.只提供 ...

  6. 打造linux下bt、电驴、ftp一体服务器

    打造个人专用bt.电驴.ftp一体服务器 操作系统选择了Debian 4.0(etch),当服务器当然要用linux了,稳定嘛~ 下载地址: [url=http://debian.cn99.com/d ...

  7. 如何用iptables限制BT、电驴等网络流量(示例如何过滤mark标志包)

    今年4月,看到一则报道说尽管某宽带公司现有技术可以容纳的网络用户容量为400至600万用户,可是目前,在容纳了45万用户的情况下,网络已经拥挤不堪,时常出现断网情况,一到上网高峰,网速就会急剧下降. ...

  8. 如何用iptables限制BT、电驴等网络流量

    今年4月,看到一则报道说尽管某宽带公司现有技术可以容纳的网络用户容量为400至600万用户,可是目前,在容纳了45万用户的情况下,网络已经拥挤不堪,时常出现断网情况,一到上网高峰,网速就会急剧下降. ...

  9. C语言实现电驴下载完成后自动关机

    本着共享的精神,电驴下载完成后不能自动关机.但我觉得这样得不偿失,可以列出N条理由来支持我的观点,节约资源.环保.省钱.延长电脑寿命--那么,如何能实现电驴下载完成后自动关机呢? 方案一    截获电 ...

最新文章

  1. 一步一步教你在 Android 里创建自己的账号系统(一)
  2. 转:Swing中的线程探究
  3. 6.没有Release文件。N:无法安全地用该源进行更新,所以默认禁用该源解决
  4. Metasploit设置LHOST参数技巧
  5. linux系统之编译安装mysql
  6. linux shell grep 搜索数据 赋值变量 没有换行符
  7. 题目1172:哈夫曼树
  8. Linux下编译一个静态链接的程序的注意点
  9. 缓存初解(四)---Ibatis的缓存配置+Ehcache
  10. Python学习笔记:基础
  11. win10: Coursera 视频无法观看问题解决。
  12. OSI网络七层模型简明教程
  13. Nginx虚拟目录alias和root目录
  14. pixel和毫米怎么换算_压力传感器相关压力单位换算
  15. blender视图缩放_如何使用主视图类型缩放Elm视图
  16. 【Python学习】 简单语法与常见错误(持续更新)
  17. mongodb 导出时间格式_MongoDB批量将时间戳转为通用日期格式示例代码 _ 蚂蚁视界...
  18. Python接口自动化之pymysql数据库操作
  19. 电子密封胶正常固化与非正常固化差别是什么?
  20. cnapckSurround c++builder Region 代码折叠快捷键

热门文章

  1. unity 麻将 用于打出去牌后在桌面相应的位置生成发出去的牌
  2. 一文读懂链上身份:赛道及项目一览
  3. 北斗/GPS如何实现定位
  4. 【操作系统】操作系统在计算机中扮演的角色
  5. ec12编码器电路图_光电编码器电路图.DOC
  6. 《Beta Embeddings for Multi-Hop Logical Reasoning in Knowledge Graphs》论文阅读笔记
  7. 百利网总结:网店如何推广
  8. 和AWS云游四海@姓“诸葛”,名“io”
  9. 滴滴Logi-KafkaManager对接夜莺实现告警配置
  10. The Pilots Brothers‘ Refrigerator(高效贪心)