在VSCode中首次构建时,MSC_ver值不匹配

时间:2019-05-08 06:15:07

标签: visual-studio-code

我正在尝试使用MSVC lib为C ++设置Visual Studio代码。     这样做时,我在构建“ hello world”程序时面临链接错误。

以下是我正在使用的配置。

c_cpp_properties.json文件的配置:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.14393.0",
            "compilerPath": "c:/apps/MVS15/VC/Tools/MSVC/14.10.25017/bin/Hostx86/x86/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

Tasks.json文件的配置:

"version": "2.0.0",
    "tasks": [
        {
            "label": "msvc build",
            "type": "shell",
            "command": "cl.exe",
            "args": [
                "/EHsc",
                "Zi",
                "/Fe:",
                "main.exe",
                "main.cpp"
            ]
        }
    ]

Launch.json文件的配置:

"version": "0.2.0",
    "configurations": [
        {
            "name": "(msvc) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": " ${workspaceFolder}/main.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false
        }
    ]

以下是构建后终端中的输出。

libcpmt.lib(uncaught.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(xthrow.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(syserror.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(cout.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(xlock.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(locale0.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(iosptrs.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(locale.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(newaop.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(wlocale.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(xlocale.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
libcpmt.lib(xdateord.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1910' in main.obj
main.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@YAXPAXI@Z) referenced in function "public: virtual void * __thiscall std::_Generic_error_category::`scalar

如何解决此链接器错误?

0 个答案:

没有答案