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;
.Hi,
I'm using Clion 2024.3, Clang 19.1.4, and CMake 3.31.1. Clion is still showing the error "Module 'std' not found," but the project runs fine.
Pkazusa1412, please check if the Nova engine is enabled in your CLion. If it is enabled, then you faced CPP-39632. You can use the workaround described in this comment.