You could also run the vcvars32.bat file from the directory C:\Program Files\Microsoft Visual Studio 8\VC\bin
(this is in your path) prior to your cl
command.
Like this:
C:\Users\nathan\Desktop>vcvars32
C:\Users\nathan\Desktop>cl minimal.c
vcvars32 calls C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
which sets up the required environment for compiling and linking.
The environment variables are INCLUDE
, LIB
, and PATH
.
The compiler looks for header files in the INCLUDE path during compile, and libraries are fetched from the LIB path during link.
For me, with Visual Studio 2017,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\vsdevcmd.bat"
is the command to use before compiling with cl
.
Here is the documentation.
When you started the command line, did you run the included command line shortcut that comes with the Visual Studio setup? This will set the correct environment variables for you so that the compilation will work correctly.
You've added your INCLUDE paths to your PATH environment variable. Use vcvars32.bat as the others have suggested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With