microsoft / microsoft/vscode-cpptools

External dependency not found, but found

Open
#10,216 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Configuration Language Service more info needed not reproing
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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)

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.

Research direction

Reproduce the issue with the CMakeLists.txt, Main.cpp, fmt submodule, and the documented cmake commands on Windows. Compare the generated compile_commands.json with the C/C++ extension's Custom browse configuration and Custom configurations, focusing on the lowercased include path; done means external headers resolve without a not-found diagnostic while navigation continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.