Finding version of Microsoft C++ compiler from command-line (for makefiles)

后端 未结 6 1137
孤城傲影
孤城傲影 2020-12-04 21:00

I must be missing something really obvious, but for some reason, the command-line version of the Microsoft C++ compiler (cl.exe) does not seem to support reporting just its

6条回答
  •  粉色の甜心
    2020-12-04 21:40

    Create a .c file containing just the line:

    _MSC_VER
    

    or

    CompilerVersion=_MSC_VER
    

    then pre-process with

    cl /nologo /EP .c
    

    It is easy to parse the output.

提交回复
热议问题