Invoking cl.exe (MSVC compiler) in Cygwin shell

前端 未结 12 2224
执念已碎
执念已碎 2020-12-04 16:50

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

12条回答
  •  暖寄归人
    2020-12-04 17:19

    I couldn't add comments to Diomidis's reply :(, so had to post an answer instead. I agree with his answer, but it would be tedious to do "open a command prompt", run Visual Studio/vcvars32.bat and then run Bash. If you don't bother about cluttering you environment, the best alternative is to modify Cygwin.bat and modify it to look something like this:

    @echo off
    D:
    chdir D:\cygwin\bin
    "%VS71COMNTOOLS%\vsvars32.bat" && bash --login -i
    

    Substitute the environment variable VS71COMNTOOLS with something appropriate on your machine.

    There is no need to open a command prompt and run Bash manually. I like this solution a lot :). I couldn't give credits to the real author of this hack, as I couldn't find a link back to his article, sorry about that!

提交回复
热议问题