microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.55k forks source link

IntelliSense generates `command-line error: invalid option: --using_directory` when starting VSCode from Developer Command Prompt for VS on ARM64 machine #11701

Closed x6eull closed 8 months ago

x6eull commented 11 months ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: An error command-line error: invalid option: --using_directory C/C++(571) always displays at the first char of a .c or .cpp file, no matter the content, even if the file is empty.

Steps to reproduce:

  1. Start Developer Command Prompt for VS 2022
  2. Type code and run
  3. Open a folder including .c or .cpp file
  4. Open the. c or .cpp file, and the error is generated. Visual Studio installed components: Desktop development using C++, MSVC v143 - VS 2022 C ++ ARM64/ARM64EC Generation Tools (latest), Windows 11 SDK (10.0.22621.0)

Expected behavior: No such error generated

Configuration and Logs

c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-arm64",
            "compilerPath": "cl.exe"
        }
    ],
    "version": 4
}

C/C++: Log Diagnostics:
Version: 1.18.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "e:/dev-temp/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-arm64",
    "compilerPath": "cl.exe",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "cl.exe",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "e:/dev-temp/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.18.3.0
Translation Unit Mappings:
[ E:\dev-temp\test.c ]:
    E:\dev-temp\test.c
Translation Unit Configurations:
[ E:\dev-temp\test.c ]:
    Process ID: 320
    Memory Usage: 40 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostarm64\arm64\cl.exe
    Includes:
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-arm64
    Other Flags:
        --using_directory
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86
        --using_directory
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86\store\references
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0
        --using_directory
        C:\Windows\Microsoft.NET\Framework\v4.0.30319
Total Memory Usage: 40 MB

Other Extensions

No response

Additional context

No response

sean-mcmanus commented 11 months ago

@x6eull We're adding the --using_directory to the variables in the LIBPATH environment variable. For some reason, your LIBPATH appears to have x86 references instead of ARM64, i.e. it could be a bug with the VS developer command prompt. What do you get when you run the following in a cmd prompt?

set LIBPATH

x6eull commented 11 months ago

I get following when I start VS developer command prompt directly from Start Menu:

LIBPATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework\v4.0.30319

I use VsDevCmd -arch=arm64 and get:

LIBPATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\ARM64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319

then start code in that shell, the error still appearing.

github-actions[bot] commented 8 months ago

Hey @sean-mcmanus, this issue might need further attention.

@x6eull, you can help us out by closing this issue if the problem no longer exists, or adding more information.