简体   繁体   English

学习 C++20:导入<iostream> ; 错误?

[英]Learning C++20: import <iostream>; error?

I'm starting to learn C++20, my first compilable language...我开始学习 C++20,我的第一个可编译语言……

import <iostream>;

int main()
{
    int answer {42};
    std::cout << "The answer is "
            << answer
            << std::endl;
    return 0;

}

When I try to compile the file above, I get an error message due to the compiler not recognizing the statement import <iostream>;当我尝试编译上面的文件时,由于编译器无法识别语句import <iostream>;我收到一条错误消息。 , even though I have the newest version of GCC compiler for Ubuntu 20.04.4 LTS. ,即使我有适用于 Ubuntu 20.04.4 LTS 的最新版本的 GCC 编译器。

C++ 20 is considered a new standard (or maybe the latest standard). C++ 20 被认为是一个新标准(或者可能是最新标准)。 So most of the compilers do not have full coverage of everything in C++ 20 and the GCC compiler that you are using does not know what is import <iostream> because it does not have full coverage.因此,大多数编译器都没有完全覆盖 C++ 20 中的所有内容,并且您使用的 GCC 编译器知道什么是import <iostream>因为它没有完全覆盖。 What you could do, is to check out this list of compilers supporting C++ 20.您可以做的是查看支持 C++ 20 的编译列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM