Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate system include path in user config not being auto-removed #2177

Closed
vincentmathis opened this issue Jun 23, 2018 · 2 comments
Closed
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@vincentmathis
Copy link

Describe the bug

  • OS and Version: Windows 7 64bit
  • VS Code Version: 1.24.1
  • C/C++ Extension Version: Should be the newest.

IntelliSense didn't find stdlib.h in C:/MinGW/include
Other headers in this path were no problem though.

I changed the path to C:\MinGW\include and now it finds stdlib.h
Using forward slashes worked fine a few days ago.

{
    "configurations": [
        {
            "name": "Windows",
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "${workspaceFolder}\\include",
                    "C:\\MinGW\\include"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "${workspaceFolder}",
                "${workspaceFolder}\\include",
                "C:\\MinGW\\include"
            ],
            "defines": [],
            "compilerPath": "C:\\MinGW\\bin\\g++.exe",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "cStandard": "c89"
        }
    ],
    "version": 4
}

Changing it to

 "includePath": [
                "${workspaceFolder}",
                "${workspaceFolder}\\include",
                "C:/MinGW/include"
            ],

shows cannot open source file "stdlib.h" (dependency of "string")
Other header in this path like C:/MinGW/include/SDL2/SDL.h don't produce this error.

@bobbrow
Copy link
Member

bobbrow commented Jun 25, 2018

The bug is that our duplicate path removal logic is failing to remove your c:/MinGW/include path. The system include path requires very specific ordering for GCC/CLang because of the use of #include_next so when you provide the compilerPath we attempt to remove any duplicates so that your config does not accidentally disrupt the ordering.

This is a bug we should fix, but fortunately, you can fix your problem right now by just deleting the c:/MinGW/include line from your configuration. We're already using that path internally.

@bobbrow bobbrow changed the title includePath has some Problems when using forward slashes under Windows (which has worked before) Duplicate system include path in user config not being auto-removed Jun 25, 2018
@sean-mcmanus sean-mcmanus self-assigned this Feb 12, 2019
@sean-mcmanus sean-mcmanus added this to the February 2019 milestone Feb 12, 2019
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 12, 2019
@sean-mcmanus sean-mcmanus removed their assignment Feb 12, 2019
@sean-mcmanus
Copy link
Contributor

This should be fixed with the latest insiders: https://github.com/Microsoft/vscode-cpptools/releases (unless the includePath ends with "/").

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

3 participants