clang "error: no member named X in namespace std" in CI
A name like std::string or std::make_unique lives in a specific header and standard. If that header is missing, or the dialect is too old, clang reports "no member named X in namespace std".
What this error means
Code that built elsewhere fails on clang because a standard facility is used without its header, or because the C++ standard on the runner is older than the feature requires.
clang
app.cpp:6:8: error: no member named 'make_unique' in namespace 'std'
6 | auto p = std::make_unique<int>(3);
| ~~~~~^Common causes
How to fix it
Include the declaring header
- Add the standard header that declares the name.
- Recompile to confirm std::X resolves.
C++
#include <memory> // std::make_unique, std::unique_ptrSelect a recent C++ standard
Set the language standard high enough for the feature, both at the compiler and in CMake.
CMakeLists.txt
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)How to prevent it
- Include the exact standard headers your code uses and pin a C++ standard high enough for the features, instead of depending on transitive includes.
Related guides
clang "error: call to undeclared function; ISO C99 ... implicit declarations" in CIFix clang "error: call to undeclared function ...; ISO C99 and later do not support implicit function declara…
gcc "warning: implicitly-declared copy assignment is deprecated [-Wdeprecated-copy]" fails CIFix gcc "implicitly-declared copy assignment operator ... is deprecated [-Wdeprecated-copy]" promoted to an e…