How to enable standard library modules?
Answered
How do I enable standard library modules in Clion?
I found this but it only talks about using your own modules. I chose C++20 support when making the project but trying to do “import std” just results in an error that it can't resolve it.
Please sign in to leave a comment.
Hello!
Firstly, standard library modules
std
andstd.compat
are the C++23 feature, not C++20 - https://en.cppreference.com/w/cpp/standard_library#Importing_modules.Secondly, CMake has added support for
import std;
only recently - https://www.kitware.com/import-std-in-cmake-3-30/. CMake 3.30 hasn't been released yet, therefore CLion doesn't bundle it yet. You can try installing one of the CMake 3.30 release candidates and selecting it inFile | Settings | Build, Execution, Deployment | Toolchains
. Also, please make sure to use compilers which supportimport std;
.