microsoft / microsoft/vscode-cpptools

External dependency not found, but found

Aperta
#10,216 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Feature: Configuration Language Service more info needed not reproing
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre il problema con CMakeLists.txt, Main.cpp, il sottomodulo fmt e i comandi cmake documentati su Windows. Confrontare il compile_commands.json generato con la Custom browse configuration e le Custom configurations dell'estensione C/C++, concentrandosi sul percorso di inclusione in minuscolo; il lavoro è completato quando gli header esterni vengono risolti senza una diagnostica not-found e la navigazione continua a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cmake, cpp
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.