WinDDK的source/makefile编译支持batch command方式,相当方便。实际上用它来编译MFC程序也是可能的。但要注意一点:对使用UNICODE程序,要设置USE_MFCUNICODE=1,不是USE_MFC=1。用错地话link会搞错入口函数,你的程序运行时就会报Access Violation.
庞大的Visual Studio Ide环境或SDK程序包可以不用在安装了。
Z:> type .../test/sources TARGETNAME=test TARGETPATH=obj TARGETTYPE=PROGRAM
SOURCES= test.cpp test.rc
C_DEFINES=$(C_DEFINES) -D_UNICODE -D_AFXDLL INCLUDES=.;..\sys\;$(DDK_INC_PATH);$(SDK_INC_PATH);$(MFC_INC_PATH);$(INCLUDES)
TARGETLIBS=$(DDK_LIB_PATH)\user32.lib \ $(DDK_LIB_PATH)\kernel32.lib \ $(DDK_LIB_PATH)\comctl32.lib \ $(DDK_LIB_PATH)\ws2_32.lib
USE_MFCUNICODE=1 PRECOMPILED_CXX=1 PRECOMPILED_INCLUDE=stdafx.h