Skip to content

Spurious Intellisense Errors on MacOS CMake project #12255

Open
@LovingSalamander

Description

@LovingSalamander

Environment

  • OS and Version: MacOS Sonoma 14.4.1
  • VS Code Version: 1.88.1
  • C/C++ Extension Version: 1.19.9
  • If using SSH remote, specify OS of remote machine: N/A

Bug Summary and Steps to Reproduce

Bug Summary:

The repository https://github.com/LeeTeng2001/metal-cpp-cmake builds on this machine and runs without issue from the command line and in VS code with the cmake extension. However every source file is littered with intellisense errors that do not occur during builds.

image

To reproduce, you can clone the repository, configure it for CMake, and open any of the source files under src/learn-metal.

Configuration and Logs

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

C/C++ Log Diagnostics:

{
  "os": "darwin",
  "vscodeVersion": "1.88.1",
  "cmtVersion": "1.17.17",
  "configurations": [
    {
      "folder": "/Users/jon/development/cpp/metal-cpp-cmake",
      "cmakeVersion": "3.29.2",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {
        "C": "/usr/bin/clang",
        "CXX": "/usr/bin/clang++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/00-window/00-window.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/02-argbuffers/02-argbuffers.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/03-animation/03-animation.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/01-primitive/01-primitive.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/09-compute-to-render/09-compute-to-render.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/05-perspective/05-perspective.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/10-frame-debugging/10-frame-debugging.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/04-instancing/04-instancing.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/08-compute/08-compute.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/07-texturing/07-texturing.cpp",
      "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/06-lighting/06-lighting.cpp"
    ],
    "responses": [
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/00-window/00-window.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/02-argbuffers/02-argbuffers.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/03-animation/03-animation.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/01-primitive/01-primitive.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/09-compute-to-render/09-compute-to-render.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/05-perspective/05-perspective.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/10-frame-debugging/10-frame-debugging.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/04-instancing/04-instancing.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/08-compute/08-compute.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/07-texturing/07-texturing.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      },
      {
        "uri": "file:///Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/06-lighting/06-lighting.cpp",
        "configuration": {
          "includePath": [
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp",
            "/users/jon/development/cpp/metal-cpp-cmake/metal-cmake/metal-cpp-extensions"
          ],
          "defines": [],
          "compilerPath": "/usr/bin/clang++",
          "compilerArgs": [],
          "compilerFragments": [
            "-g -std=gnu++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk"
          ]
        }
      }
    ],
    "partialMatches": [],
    "targetCount": 12,
    "executablesCount": 11,
    "librariesCount": 1,
    "targets": [
      {
        "name": "00-window",
        "type": "EXECUTABLE"
      },
      {
        "name": "01-primitive",
        "type": "EXECUTABLE"
      },
      {
        "name": "02-argbuffers",
        "type": "EXECUTABLE"
      },
      {
        "name": "03-animation",
        "type": "EXECUTABLE"
      },
      {
        "name": "04-instancing",
        "type": "EXECUTABLE"
      },
      {
        "name": "05-perspective",
        "type": "EXECUTABLE"
      },
      {
        "name": "06-lighting",
        "type": "EXECUTABLE"
      },
      {
        "name": "07-texturing",
        "type": "EXECUTABLE"
      },
      {
        "name": "08-compute",
        "type": "EXECUTABLE"
      },
      {
        "name": "09-compute-to-render",
        "type": "EXECUTABLE"
      },
      {
        "name": "10-frame-debugging",
        "type": "EXECUTABLE"
      },
      {
        "name": "METAL_CPP",
        "type": "STATIC_LIBRARY"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Errors:
[{
	"resource": "/Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/00-window/00-window.cpp",
	"owner": "C/C++: IntelliSense",
	"code": "754",
	"severity": 8,
	"message": "a class-qualified name is not allowed",
	"source": "C/C++",
	"startLineNumber": 104,
	"startColumn": 11,
	"endLineNumber": 104,
	"endColumn": 49
},{
	"resource": "/Users/jon/development/cpp/metal-cpp-cmake/src/learn-metal/00-window/00-window.cpp",
	"owner": "C/C++: IntelliSense",
	"code": "20",
	"severity": 8,
	"message": "identifier \"UTF8StringEncoding\" is undefined",
	"source": "C/C++",
	"startLineNumber": 108,
	"startColumn": 82,
	"endLineNumber": 108,
	"endColumn": 100
},{
....

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Feature: Configuration ProviderRelated to the configurationProvider property, e.g. ms-vscode.cmake-tools, ms-vscode.makefile-tools.Language Serviceinvestigate: reproThis issue's repro steps needs to be investigated/confirmed

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions