I\'m heavily using Cygwin (with PuTTY shell). But, it\'s quite tricky to invoke cl.exe
(that is, the Visual C++ compiler toolchain) in the Cygwin Bash shell. R
I actually used JesperE answer https://stackoverflow.com/a/374411/380247 (that allows you to switch between VS versions) but found a way not to create temporary bat file. So result is much simpler.
function run_in_vs_env
{
eval vssetup="\$$1\\vsvars32.bat"
cmd /Q /C call "$vssetup" "&&" "${@:2}"
}
function run_vs11
{
run_in_vs_env VS110COMNTOOLS "$@"
}
function run_vs10
{
run_in_vs_env VS100COMNTOOLS "$@"
}
I suggest to add these lines to your .bash_functions or something similar and export these functions there. This will allow you to use functions in your bash scripts.
export -f run_in_vs_env
export -f run_vs11
export -f run_vs10
Then you should be able to do:
run_vs11 cl