Compiler version info

Hi,

i am using VC8. when i do cl following is the output:

S:\build>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50215.44 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

S:\build>which cl
d:\Program Files\Microsoft Visual Studio 8\VC\BIN/cl.exe

S:\SS2.7Projects\SchedulingService\v2.7.7.0\build>

_MSC_VER gives me 1400 but i want the value '50215' out of '14.00.50215.44'. is it possible how

Thanks,
Chanakya




Answer this question

Compiler version info

  • Krishnan Margabandhu

    After losing this particular race condition, I reread the question.  You want this as a macro.  Of course Jonathan's technique is the way to go.

    Here's what I said, in case it matters.

    If you can get a hold of sed.exe, you can do the following:

    cl 2>&1 | findstr (R) | sed s/.*14\.00\.// | sed s/\..*//

    2>&1 turns stderr into stdout, we pick out the copyright line, and then strip the characters before and after the version number.

    e.g.
    cl 2>&1 | findstr (R) | sed s/.*14\.00\.// | sed s/\..*//
    50215

    If you want to assume less about the format, you can refine the regular expressions.

    To get it: http://unxutils.sourceforge.net/
    To understand it: http://www.gnu.org/software/sed/manual/sed.html

    Brian


  • VicIbar

    Thanks Jonathan.

    i tried the macro for VS 2005 beta 2

    C:\build>cl
    Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50215.44 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.

    usage: cl [ option... ] filename... [ /link linkoption... ]

    C:\build>devenv ..\..\..\msc_full_ver\msc_full_ver.sln /build "Debug"

    Microsoft (R) Visual Studio Version 8.0.50215.44.
    Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
    ------ Build started: Project: msc_full_ver, Configuration: Debug Win32 ------
    Compiling...
    stdafx.cpp
    Compiling...
    msc_full_ver.cpp
    Compiling manifest to resources...
    Linking...
    Embedding manifest...
    Build log was saved at "file://c:\Sched_Q4_MR1_ICC\msc_full_ver\msc_full_ver\Deb
    ug\BuildLog.htm"
    msc_full_ver - 0 error(s), 0 warning(s)
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

    C:\build>C:\Sched_Q4_MR1_ICC\msc_full_ver\msc_full_ver\Debug\msc_full_ver.exe
    140050215

    also tried for PSDK April 2005

    C:\build>which cl
    C:\Program Files\MicrosoftPSDK_1830\Bin\Win64/cl.exe

    C:\build>cl
    Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40310.39 for IA-64
    Copyright (C) Microsoft Corporation.  All rights reserved.

    usage: cl [ option... ] filename... [ /link linkoption... ]

    C:\\build>..\..\..\msc_full_ver\Debug\msc_full_ver.exe
    13103077

    why is it coming different in case of PSDK



  • MTennants

    There is also the predefined macro_MSC_FULL_VER: which for the final Whidbey release is defined as 140050727

  • Jay 2k

    Different compiler: different version number Smile

    Beta 2 == 50215 == 2005/02/15
    PSDK == 40310 == 2004/03/10

    The x64 and IPF tools in the PSDK are really old.

  • mylaputa

    I don't believe there is a way of extracting this number. You can dump this to a file and then parse it.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • Compiler version info