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?
Edit: sorry, didn't notice the 'without .sln' part. Ignore this answer please. I'm leaving it in place for others that may actually need this but it's not an answer to the original question.
If you just want to build a solution/project file (that is, most of your build settings are already defined in your project file), you can use devenv.exe
to build the solution/project for you - this is probably the simplest way of doing a build from the command line.
For example:
devenv.exe myapp.sln /Rebuild "Release|x64"
cleans & builds the myapp.sln
solution in the Release|x64
configuration.
If you run
devenv.exe /?
command, it gives you all command-line options. You can use devenv
to build only a specific project in the solution by using the `/project' switch.
If you need more flexibility (and you're willing to spend a lot of time writing the right script), you can use nmake
to build from the command-line, but I don't know that well, so I can't give useful advice.