这是设置环境变量的 command /k "vsvars32.bat"@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE @SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET @SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework @SET FrameworkVersion=v1.0.3705 @SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK @rem Root of Visual Studio common files.@if "%VSINSTALLDIR%"=="" goto Usage @if "%VCINSTALLDIR%"=="" set VCINSTALLDIR=%VSINSTALLDIR%@rem @rem Root of Visual Studio ide installed files. @rem @set DevEnvDir=%VSINSTALLDIR%@rem @rem Root of Visual C++ installed files. @rem @set MSVCDir=%VCINSTALLDIR%\VC7@rem @echo Setting environment for using Microsoft Visual Studio .NET tools. @echo (If you also have Visual C++ 6.0 installed and wish to use its tools @echo from the command line, run vcvars32.bat for Visual C++ 6.0.) @rem@REM %VCINSTALLDIR%\Common7\Tools dir is added only for real setup.@set PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%; @set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\prerelease;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE% @set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib\prerelease;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB%@goto end:Usage@echo. VSINSTALLDIR variable is not set. @echo. @echo SYNTAX: %0@goto end:end
您自己找吧
2)编写nmake文档
#0001 # filename : generic.mak
#0002 # make file for generic.exe (Generic Windows Application)
#0003 # usage : nmake generic.mak (Microsoft C/C++ 9.00) (Visual C++ 2.x)
#0004 # usage : nmake generic.mak (Microsoft C/C++ 10.00) (Visual C++ 4.0)
#0005
#0006 all: generic.exe
#0007
#0008 generic.res : generic.rc generic.h
#0009 rc generic.rc
#0010
#0011 generic.obj : generic.c generic.h
#0012 cl -c -W3 -Gz -D_X86_ -DWIN32 generic.c
#0013
#0014 generic.exe : generic.obj generic.res
#0015 link /MACHINE:I386 -subsystem:windows generic.res generic.obj \
#0016 libc.lib kernel32.lib user32.lib gdi32.lib使用方法
按照上面的编写方法写,保存为makefile,或者 youmakefile.mak
nmake //默认找makefile
或者
nmake youmakefile.mak。
command /k "vsvars32.bat"@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v1.0.3705
@SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK
@rem Root of Visual Studio common files.@if "%VSINSTALLDIR%"=="" goto Usage
@if "%VCINSTALLDIR%"=="" set VCINSTALLDIR=%VSINSTALLDIR%@rem
@rem Root of Visual Studio ide installed files.
@rem
@set DevEnvDir=%VSINSTALLDIR%@rem
@rem Root of Visual C++ installed files.
@rem
@set MSVCDir=%VCINSTALLDIR%\VC7@rem
@echo Setting environment for using Microsoft Visual Studio .NET tools.
@echo (If you also have Visual C++ 6.0 installed and wish to use its tools
@echo from the command line, run vcvars32.bat for Visual C++ 6.0.)
@rem@REM %VCINSTALLDIR%\Common7\Tools dir is added only for real setup.@set PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%;
@set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\prerelease;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE%
@set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib\prerelease;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB%@goto end:Usage@echo. VSINSTALLDIR variable is not set.
@echo.
@echo SYNTAX: %0@goto end:end