我在網上下了該書的來源程式,在原生編譯第一個程式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地址