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

included file <bits/stl_set.h> emit error #1613

Closed
iaIm14 opened this issue Apr 27, 2023 · 2 comments
Closed

included file <bits/stl_set.h> emit error #1613

iaIm14 opened this issue Apr 27, 2023 · 2 comments

Comments

@iaIm14
Copy link

iaIm14 commented Apr 27, 2023

Hi, I'm working on my Linux Fedora 36 machine, and I installed gcc-c++ (using dnf install gcc-c++-12.2.1-4.fc36.x86_64) to compile my program. I'm using Visual Studio Code with the llvm-vs-code-extensions.vscode-clangd extension, and I added -I/usr/include/c++/12 to the user configuration file of the clangd extension. However, when I include the file <bits/stl_set.h> (absolute path = /usr/include/c++/12/bits/stl_set.h), clangd reports unexpected errors from the header file. Specifically, the error looks like:

In included file: no template named 'less' in namespace 'std' in line 92 

the header file's content:

  template<typename _Key, typename _Compare = std::less<_Key>,
	   typename _Alloc = std::allocator<_Key> >
    class set ...

System information

Output of clangd --version:
clangd version 15.0.6 (https://github.com/llvm/llvm-project 088f33605d8a61ff519c580a71b1dd57d16a03f8)
Features: linux+grpc
Platform: x86_64-unknown-linux-gnu
Editor/LSP plugin:
VSCode + clangd
Operating system:
Linux fedora 6.2.10-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 6 23:20:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@zyn0217
Copy link

zyn0217 commented Apr 27, 2023

However, when I include the file <bits/stl_set.h> (absolute path = /usr/include/c++/12/bits/stl_set.h)

Sorry but why would you consider including an internal header of libstdc++?

@iaIm14
Copy link
Author

iaIm14 commented Apr 27, 2023

However, when I include the file <bits/stl_set.h> (absolute path = /usr/include/c++/12/bits/stl_set.h)

Sorry but why would you consider including an internal header of libstdc++?

Thank you for bringing that to my attention, it seems that we shouldn't include this header file directly, but I came to this location by following the error reported by the clangd extension when reviewing my project code. However, after reinstalling gcc, it is now working properly. Perhaps I accidentally reformatted a system header file before🥲. Sorry for the trouble.

@iaIm14 iaIm14 closed this as completed Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants