Nele
Nele

Reputation: 111

Dumpbin and _MSC_VER

I am developing C++ in Visual Studio 2017, version 15.7, VCToolsVersion 14.14.26428.

I noticed that when I run dumpbin on a static library, I get a different version for _MSC_VER than expected.

To illustrate my problem, I created a static library testDumpbin.lib containing a simple class, testClass:

testClass.h:

#pragma once

class testClass
{
public:
    testClass();

private:
    int n;
};

testClass.cpp:

#include "testClass.h"
#include <string>

#define STRING2(x) #x
#define STRING(x) STRING2(x)
#pragma message("")
#pragma message( "_MSC_VER (compiler verion) " STRING(_MSC_VER))
#pragma message("")

testClass::testClass()
{
    n = 3;
}

I added some preprocessor lines that print the _MSC_VER macro.

When I compile this code in debug mode (turned off Precompiled headers in properties – C/C++), I get:

1>_MSC_VER (compiler verion) 1914

Which is what I expected since I am running toolset 14.14 (see also https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B)

I then went on to use dumpbin (can be ran from the VS Developer Command Prompt which you can launch from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\LaunchDevCmd.bat ):

dumpbin testDumpbinLib.lib /rawdata:1 > dumpbin.log

And in there I find that _MSC_VER = 1900:

  00000000: 20 20 20 2F 46 41 49 4C 49 46 4D 49 53 4D 41 54     /FAILIFMISMAT
  00000010: 43 48 3A 22 5F 4D 53 43 5F 56 45 52 3D 31 39 30  CH:"_MSC_VER=190
  00000020: 30 22 20 2F 46 41 49 4C 49 46 4D 49 53 4D 41 54  0" /FAILIFMISMAT
  00000030: 43 48 3A 22 5F 49 54 45 52 41 54 4F 52 5F 44 45  CH:"_ITERATOR_DE
  00000040: 42 55 47 5F 4C 45 56 45 4C 3D 32 22 20 2F 46 41  BUG_LEVEL=2" /FA

Why isn't it _MSC_VER = 1914 in the dumpbin output?

Thanks a lot for your help!

Upvotes: 3

Views: 738

Answers (0)

Related Questions