VS2010编译Gh0st3.6(二)

来源:互联网 发布:医疗网络咨询技巧 编辑:程序博客网 时间:2024/06/01 17:40

VS2010编译Gh0st3.6(二)

二.编译Gh0st

成功编译CJ60Lib界面库之后,就可以开始编译Gh0st了。

2.1 转换Gh0st3.6项目

直接用VS2010打开Gh0st3.6\gh0st.dsw 提示转换项目,确定转换就行了。这里一共三个项目:gh0st,install,svchost。编译的时候需要先编译svchost再编译install,最后才编译gh0st。

 

2.2 编译svchost

相同的错误修改就不再说了,参看前面的修改方法。 
修改已说过的错误,再继续下面的错误修改。

2.2.1

1>common\FileManager.cpp(202): error C2440: “初始化”: 无法从“const char *”转换为“char *” 
1>          转换丢失限定符

char *lpExt = strrchr(lpFile, ‘.’); 
修改为: 
const char *lpExt = strrchr(lpFile, ‘.’);

 

1>e:\programming\vs2010\gh0st3.6\server\svchost\common\loop.h(160): error C2440: “=”: 无法从“const char *”转换为“char *” 
1>          转换丢失限定符

char *lpFileName = NULL;

lpFileName = strrchr(lpURL, ‘/’) + 1;

修改为:

const char *lpFileName = NULL;

lpFileName = strrchr(lpURL, ‘/’) + 1;

2.2.2

1>common\ScreenSpy.cpp(355): error C2062: 意外的类型“int”

for (int i = 0, int nToJump = 0; i < nHeight; i += nToJump) 
修改为: 
for (int i = 0, nToJump = 0; i < nHeight; i += nToJump)

2.2.3

1>common\VideoManager.cpp(123): error C4430: 缺少类型说明符 – 假定为 int。注意: C++ 不支持默认 int

定位在: 
static dwLastScreen = GetTickCount(); 
这个错误前面已经提到过,是添加现式定义类型int。这里添加现式类型为 DWORD 比较好,因为后面的函数GetTickCount返回值是DWORD类型。在这里修改如下: 
static DWORD dwLastScreen = GetTickCount();

2.2.4

1>common\ScreenManager.cpp(7): fatal error C1083: 无法打开包括文件:“winable.h”: No such file or directory

Winable头文件从VS2008里面就已经不存在了,MSDN里描述如下:

从 Visual Studio 早期版本升级项目时,您可能必须修改 WINVER 和 _WIN32_WINNT 宏,以便它们大于或等于 0×0500。 
已移除 Windows API 头文件 Winable.h。而改为包括 Winuser.h。

因为Winuser默认已经包含进来了,所以直接注释这句话就行了。但是如果直接这样,引用Winable中的函数就会出现未定义错误。所以这里除了需要注释这个头文件包含,还需要注释这个文件中的_WIN32_WINNT宏定义,或者修改宏定义大于等于500。我这里直接注释掉了。

#define _WIN32_WINNT 0×0400 
#include "ScreenManager.h" 
#include "until.h" 
#include <winable.h> // BlockInput

修改为:

//#define _WIN32_WINNT 0×0400 
#include "ScreenManager.h" 
#include "until.h" 
//#include <winable.h> // BlockInput

2.3 编译install

这个能直接编译通过,就算不修改默认字符集,但还是建议和前面一样,修改下默然字符。

2.4 编译gh0st

一开始编译就会有个错误提示而终止,如果不修改没法正常编译。

1>C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\afx.h(24): fatal error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

这个还是需要修改属性页。需要把代码生成里的运行时库改成/MT。如图:

Multi-threaded(/MT)

修改之后重新编译就能看到很多错误了。在继续下面的错误修改之前,先把前面讲到的错误类型给修改好。

2.4.1

1>control\BtnST.cpp(4): fatal error C1083: 无法打开包括文件:“stdafx.h”: No such file or directory

提示找不到stdafx.h,其实这个文件是存在的。在属性里添加“./”的包含目录就能解决了。 
在属性页的C/C++—General—Additional Include Directories 里添加。

原来的是: 
CJ60lib/Include;../common;%(AdditionalIncludeDirectories)

修改后为: 
./;CJ60lib/Include;../common;%(AdditionalIncludeDirectories)

如图:

Additional Include Directories