Importing <print> failing

Jonathan Wakely jwakely.gcc@gmail.com
Tue Mar 18 08:27:03 GMT 2025


On Tue, 18 Mar 2025, 01:38 Rud Merriam via Gcc-help, <gcc-help@gcc.gnu.org>
wrote:

> This failure occurs when trying to build and import <print> as a module.
> I'm on Ubuntu 24.04 with GCC 14.1. How do I make it work?
>

There are a lot of bugs in the modules support of GCC 14, for serious uses
of modules you might need to wait for GCC 15.

Although it looks like this error is just caused by not compiling
bits/stdc++.h as a header unit.



>
> + g++ -std=c++23 -c -fmodules-ts -xc++-system-header print
> + g++ -std=c++23 -c -fmodules-ts -x c++ Donskoy.cppm -o bin/Donskoy.o
> + g++ -std=c++23 -c -fmodules-ts donskoy.cpp -o bin/Donskoy.All.o
> In module imported at donskoy.cpp:3:1:
> /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h: error: failed to
> read compiled module: No such file or directory
> /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h: note: compiled
> module file is
> ‘gcm.cache/./usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h.gcm’
>
> The code is:
>
> module; import <print>; module Donskoy; using std::println, std::print;
> auto meow() -> void { std::println("Донской кот говорит «мяу»"); }
>
> --
>
> -73 -
> *Rud Merriam K5RUD*
> /Mystic Lake Software/ <http://mysticlakesoftware.com/>
>


More information about the Gcc-help mailing list