Clion how to enable std module support?
Answered
Using “import std;” just results in an error that Clion can't find it. How can I enable support for the standard module in Clion? I am using a C++20 project.
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;
.