The following test program
import std;
int main() {}
compiled with gcc-14
/usr/local/bin/g++ -g -std=c++23 -fconcepts -fmodules-ts -O3 -Wall -Wextra test400.cc --output test400
gives the following errors:
std: error: failed to read compiled module: No such file or directory
std: note: compiled module file is 'gcm.cache/std.gcm'
std: note: imports must be built before being imported
std: fatal error: returning to the gate for a mechanical issue
The standard library module std should be available, but obviously is not.
Aside from header units: is the a way to create the std module by my own?
GCC 15.0 supports it with -fsearch-include-path bits/std.cc.
g++ -std=c++20 -fmodules -fsearch-include-path bits/std.cc file.cpp
That will take a few seconds, once it’s done you'll have a cache file at gcm.cache/std.gcm. You’ll then be able to compile faster by removing -fsearch-include-path bits/std.cc from your command.
g++ -std=c++20 -fmodules file.cpp
References:
GCC's libstdc++ does not support P2465R3 yet, which allows for import std;
https://en.cppreference.com/w/cpp/compiler_support/23
Note that C++23 is not yet finalized
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With