microsoft / microsoft/vscode-cpptools

External dependency not found, but found

Offen
#10,216 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug Feature: Configuration Language Service more info needed not reproing
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Environment
  • OS and Version: Windows 10
  • VS Code Version: 1.73.1
  • C/C++ Extension Version: 1.13.5 (also happend on stable)
Bug Summary and Steps to Reproduce

Bug Summary: It marks external dependency headers at not found, but still you can jump to them and on the logs seems like the compile commands include them, but with wrong case
Let's do a simple example with external dependency, with cmake and using git submodules:
CMakeLists.txt

cmake_minimum_required(VERSION 3.0.0)
project(MyProject VERSION 0.1.0)

add_subdirectory("third_party/fmt")

add_executable(MyProject Main.cpp)
target_link_libraries(MyProject
    fmt)

Remember to clone the fmt library on third_party folder
main.cpp

#include <fmt/core.h>

int 
main(int argc, char** argv) 
{
    fmt::print("Hello World");
    return 0;
}

If you compile this with cmake:

cmake -B build
cmake --build build

It works just fine, but cpptools is having trouble resolving <fmt/core.h>
image

Here are the logs:

-------- Diagnostics - 1/12/2022, 17:54:34
Version: 1.13.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22000.0",
    "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "c:/users/nnyag/documents/vs-test/deps/fmt/include",
        "c:/users/nnyag/documents/vs-test",
        "c:/users/nnyag/documents/vs-test/deps/fmt/src",
        "c:/users/nnyag/documents/vs-test/deps/fmt/include/fmt",
        "c:/users/nnyag/documents/vs-test/deps/fmt"
    ],
    "compilerPath": "c:/strawberry/c/bin/g++.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "-g"
    ]
}
Custom configurations:
[ C:\Users\nnyag\Documents\vs-test\Main.cpp ]
{
    "includePath": [
        "c:/users/nnyag/documents/vs-test/deps/fmt/include"
    ],
    "defines": [],
    "compilerPath": "c:/strawberry/c/bin/g++.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "-g"
    ]
}
There is a clear mistake here

The include paths contains the path with all the letters lowercase:
image

This error also occurs with clangd so it might be related to the editor itself, also can't be the cmake tools extension, since I've tried generating the compile_commands.json manually (also the compile commands contains the proper path)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das Problem mit der CMakeLists.txt, Main.cpp, dem fmt-Submodul und den dokumentierten cmake-Befehlen unter Windows. Vergleiche die generierte compile_commands.json mit der Custom browse configuration und den Custom configurations der C/C++-Erweiterung und konzentriere dich dabei auf den kleingeschriebenen Include-Pfad; abgeschlossen ist die Aufgabe, wenn externe Header ohne eine not-found-Diagnose aufgelöst werden und die Navigation weiterhin funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cmake, cpp
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.