想要单独的lc.exe msvc 编译程序
Visual Studio 太大了,电脑空间太小。想要 像 MinGW 的gcc命令那样用命令行编译 c,c++ 代码,有没有那种提取出来可以使用的msvc的编译器?
分享一个自己用的vc6编译脚本,适合vscode,editplus等软件使用
程序代码:
@echo off rem ============================= REM VC++ 6 编译批处理 rem ============================= rem rem 调用参数 : "$(FilePath)" rem rem "$(FilePath)" 编译文件路径 rem SETLOCAL if "%1" == "" ( echo 无输入,将退出! && goto EXIT) cd /d "%~dp1" set OUTDIR=%~dp1exeOut set FILE=%~n1 set EXT=%~x1 if /I "%EXT%" NEQ ".cpp" ( if /I "%EXT%" NEQ ".c" ( echo 输入文件错误!&& goto EXIT ) ) call D:\Develope\VC6\VC98\Bin\VCVARS32.BAT > NUL echo VC++ 6.0 编译 %1 ... echo -------------------------------------------------------------------------------- @if NOT EXIST "%OUTDIR%" ( echo. echo 输出目录不存在,创建输出目录 "%OUTDIR%" ... md "%OUTDIR%" ) set CL=/nologo /MD /W3 /O2 /EHsc /GX /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Fo"%OUTDIR%/" /Fe"%OUTDIR%/" /Fd"%OUTDIR%/" echo. echo cl.exe %1 %CL% ... cl %1 %CL% user32.lib gdi32.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib easyx*.lib SET RETURN=%ErrorLevel% echo. if %RETURN% == 0 ( echo 编译成功! ) else ( echo 编译失败,请检查错误! ) echo. echo 清理垃圾文件 ... echo. @if EXIST "%OUTDIR%\%FILE%.obj" (del "%OUTDIR%\%FILE%.obj") @if EXIST "%OUTDIR%\%FILE%.pdb" (del "%OUTDIR%\%FILE%.pdb") rem if %RETURN% == 0 ( rem CD /d "%OUTDIR%" rem echo. rem echo 正在启动程序 %OUTDIR%\%FILE%.exe... rem START %OUTDIR%\%FILE%.exe rem ) :EXIT ENDLOCAL