How to make them agree, in order of how well it works:
1. Regenerate the project's editor configuration. The build system usually has a command that emits the include paths and defines for the analyser. This is the intended mechanism and it is the fix in most cases — often available from the command palette, or it happens on a full build.
2. Do a full build first. The paths cannot be generated until the dependencies have been resolved and downloaded. On a fresh checkout the analyser is wrong until the first successful build, which is why this appears on new projects and fixes itself later.
3. Reload the window. The analyser caches aggressively and frequently keeps stale paths after a change. Reloading is not superstition here; it is genuinely the step that applies the new configuration.
4. Check you opened the right folder. Opening a subfolder rather than the project root means the analyser cannot find the project configuration at all, and this is a surprisingly common cause.