I've been Googling around for months trying to solve this, but nothing I've tried works.
So a simple program like this:
#include <concepts>
#include <iostream>
int main() {
std::cout << "Test" << std::endl;
return 0;
}
fails to compile with the error message fatal error: 'concepts' file not found
. This happens with both clang++ and g++ compilers. (For completeness: clang++-11 -std=c++20 test.cpp
and g++ -std=c++2a test.cpp
.)
My compiler versions are:
> clang++-11 --version
Ubuntu clang version 11.0.0-2~ubuntu20.04.1
> g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
If I look for my C++ headers, I can find them in /usr/include/c++
:
> find /usr -name "iostream"
/usr/lib/llvm-10/include/c++/v1/iostream
/usr/include/c++/9/iostream
However, find /usr -name "concepts"
gives nothing. So the header is definitely missing. Along with all the other C++20-specific headers, and C++20-specific functions that are defined in other headers (like [std::bit_width][1]
for example - the header can be included but the function is not defined).
And by the way, I can use all C++20 functionality. For example, I can define my own concepts, although I can't use the concepts header.
What's weird is everywhere I Google for this type of issue, the only problems I can find are people who are using an old compiler that doesn't support C++20, or are missing all C++ headers (or the compiler can't find them). But I'm not sure what I'm supposed to do given that my compiler clearly supports C++20, yet I'm missing the C++20 headers.
I did try to see if libstdc++
needed an update, but to no avail:
> sudo apt install libc++-dev
[...]
libc++-dev is already the newest version (1:10.0-50~exp1).