Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

Compile C++23 feature with gcc [closed]

$
0
0

I compile this code with g++ 14:

import std;int main(){std::println("Hello World");return 0;}

If I use this command:

g++-14 -fmodules-ts -include bits/stdc++.h 1.cpp

I get this error:

In module imported at 1.cpp:1:1:  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

and with this command:

g++-14 1.cpp

I get this error:

1.cpp:1:1: error: ‘import’ does not name a type      1 | import std;        | ^~~~~~  1.cpp:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’1.cpp: In function ‘int main()’:  1.cpp:5:10: error: ‘println’ is not a member of ‘std’    5 |     std::println("Hello World");

Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>