Visual Studio does not recognize libraries installed with vcpkg but still compiles the solution successfully

I set up vcpkg in my Visual C++ project so that I don’t have to manually set the include directory for each dependency. However, Visual Studio does not recognize the libraries (even after I run vcpkg install to install them) and shows red lines under the relevant code. Despite this, Visual C++ still compiles the solution without issues, and the errors do disappear if I unload and reload the project (or restart Visual Studio).

I saw another question that describes a similar issue. Several answers say this is caused by ReSharper, but I definitely do not have that extension installed.

I also found a post on Microsoft Developer Community that says the issue was fixed in December 2019, but this does not appear to be the case for me.

Is there anything I could do to resolve this?

vcpkg.json contents:

{
  "dependencies": [
    "opencl"
  ]
}

vcpkg-configuration.json contents:

{
  "default-registry": {
    "kind": "git",
    "repository": "https://github.com/microsoft/vcpkg",
    "baseline": "cd124b84feb0c02a24a2d90981e8358fdee0e077"
  },
  "registries": [
  ]
}

Read more here: Source link