ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.95k stars 459 forks source link

clangd can find the C++ standard library, but cannot call #1366

Closed CodingOIer closed 2 weeks ago

CodingOIer commented 2 weeks ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

NVIM v0.10.2

Operating system/version

Windows 11

Terminal name/version

Windows Terminal 1.21.2991.0

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

clangd

How to reproduce the issue

  1. Run the Windows configuration commands given in the README and install all dependencies
  2. Edit a cpp file in a folder with .clangd. You can clone https://github.com/CodingOIer/Source-Code.git and go into the project root directory to get my environment.
  3. Write a piece of C++ code
    #include <cstdio>
    int main()
    {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b);
    return 0;
    }
  4. He told me that I didn't call the functions in cstdio directly, and scanf and printf were not defined. image
  5. Trying to use the header file in C still prompts that it is not found. image
  6. Possibly useful information: LSP suggested std::scanf, but it doesn't actually work image But clangd works fine on my VSCode

Actual behavior

The C++ standard library can be found, but cannot be called

Expected behavior

No response

Support info

image image

Logs

[LSP Log](https://paste.ubuntu.com/p/FgGXwcV844/)

Additional information

No response

CodingOIer commented 2 weeks ago

My bad