microsoft / microsoft/vscode-cpptools

IntelliSense fails to find headers using cl.exe #include "" Microsoft-specific search rules (i.e. -Wmicrosoft-include)

Open
#8,296 2 comments 0 reactions 1 assignee View on GitHub

@sean-mcmanus is already working on this.

Since Dec 18, 2024.

bug Feature: Configuration investigate: repro Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Disable recursive includes and use msvc or clang mode.

  • root
    • sub1 (folder)
      • sub1_2.h
      • sub1.h
    • sub2 (folder)
      • sub2.h
    • main.cpp

main.cpp
#include "sub1/sub1.h"

sub1.h
#include "sub2/sub2.h"

sub2.h
#include "sub1_2.h"

Bug: This compiles with cl.exe (and clang, although it gives the warning from -Wmicrosoft-include), but IntelliSense fails to find the headers. See documentation at https://docs.microsoft.com/en-us/cpp/preprocessor/hash-include-directive-c-cpp?view=msvc-160 . The code isn't compilable with gcc, so it's non-portable, i.e. not recommended for new code, but legacy code might rely on the behavior.

I haven't checked if this repros with VS, and I'm not sure if it's a bug with our shared parser or if we're expected to emulate the search order ourselves.

I found this issue while investigating how to correctly deal with the clang-tidy include processing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.