Does anyone know how to use the command line compiler ('cl' and 'link') in Visual C++ to build a project? We are more used to 'make' and 'gcc' here, but were recently moved to Visual Studio. I suppose we could use nmake, but I'm hoping for some information regarding using 'cl' and 'link' (as in compiling without a .sln file).
something along the lines of
is what we want, but I just can't seem to make it work using the command line parameters. Help please?
As I tend to always say, anything Microsoft related can be found on MSDN and a quick trip to google.
cl.exe is documented here: http://msdn.microsoft.com/en-us/library/ms235639%28v=vs.100%29.aspx
It's pretty simple just enter the directory of cl.exe and write in the cmd.
cl.exe /? and then it will list all the available flags.
You need to get 2 Files in you Path:
vcvarsall.bat is a shellscript which is responsible to determine on which architecture you're running on and includes several folders into your path which the cl compiler needs. on my pc this script resides under C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
cl.exe is the compiler itself and on my pc resides under C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
i simply declared a environment variable VC_HOME : C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC and included in the Path %VC_HOME%;%VC_HOME%\bin;
now when you open the shell, at first run vcvarsall.bat and then you can say: cl MyProgramm.cpp
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