我在网上下了该书的源程序,在本机编译第一个程序ErrorShow,错误如下:
Compiling...
ErrorShow.cpp
You are not using the latest Platform SDK header/library
files. This may prevent the project from building correctly.
d:/程序案例/vc/windows核心编程/windows核心编程源码/cmnhdr.h(212) : error C2065: 'GetWindowLongPtr' : undeclared identifier
d:/程序案例/vc/windows核心编程/windows核心编程源码/cmnhdr.h(212) : error C2065: 'GWLP_HINSTANCE' : undeclared identifier
d:/程序案例/vc/windows核心编程/windows核心编程源码/01-errorshow/errorshow.cpp(83) : error C2065: 'PCTSTR' : undeclared identifier
d:/程序案例/vc/windows核心编程/windows核心编程源码/01-errorshow/errorshow.cpp(83) : error C2146: syntax error : missing ')' before identifier 'LocalLock'
d:/程序案例/vc/windows核心编程/windows核心编程源码/01-errorshow/errorshow.cpp(83) : error C2059: syntax error : ')'
d:/程序案例/vc/windows核心编程/windows核心编程源码/01-errorshow/errorshow.cpp(125) : error C2664: 'DialogBoxParamA' : cannot convert parameter 4 from 'long (struct HWND__ *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(struct HWND__ *,unsig
ned int,unsigned int,long)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
01 ErrorShow.exe - 6 error(s), 0 warning(s)
解决方法:
安装好sdk,然后配置路径
TOOL-》option-》direction下
在include下,添加
C:/PROGRAM FILES/MICROSOFT SDK/INCLUDE
在lib下,添加
C:/PROGRAM FILES/MICROSOFT SDK/LIB
这里假设sdk的安装路径是C:/PROGRAM FILES/MICROSOFT SDK
然后记得把这些添加的路径上移到第一的位置,切记
下面给出几个SDK下载地址:
http://msdn.microsoft.com/zh-cn/windows/bb980924.aspx?wt.svl=more_downloads该网址包含了所有版本的SDK
http://bbs.ghtt.net/thread-155927-1-1.html这个链接也很好
http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb&displaylang=en VC6.0所需SDK地址