Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t在C+中包括标准标题+;模块(铿锵+;+;v12) 我尝试在C++模块中包括标准头。C++ CLANV12编译器不能看到这些标题,但它们在旧的翻译单元中找到。有人能解释一下如何在C++20模块翻译单元中包含标准标题吗_C++_Module_Clang_Clang++_C++20 - Fatal编程技术网

Can';t在C+中包括标准标题+;模块(铿锵+;+;v12) 我尝试在C++模块中包括标准头。C++ CLANV12编译器不能看到这些标题,但它们在旧的翻译单元中找到。有人能解释一下如何在C++20模块翻译单元中包含标准标题吗

Can';t在C+中包括标准标题+;模块(铿锵+;+;v12) 我尝试在C++模块中包括标准头。C++ CLANV12编译器不能看到这些标题,但它们在旧的翻译单元中找到。有人能解释一下如何在C++20模块翻译单元中包含标准标题吗,c++,module,clang,clang++,c++20,C++,Module,Clang,Clang++,C++20,我使用的是clang++v12,源代码,基于Ubuntu20构建 提前谢谢 下面是一个代码示例: 文件:audio.cpp // compiler not seeing this include #include <iostream> export module audio; export int init(int fir, int sec){ ... } 完整的编译器错误: clang++ -s

我使用的是clang++v12,源代码,基于Ubuntu20构建

提前谢谢

下面是一个代码示例:

文件:audio.cpp

    // compiler not seeing this include    
    #include <iostream> 
    
    export module audio;
    
    export int init(int fir, int sec){
        ...
    }
完整的编译器错误:

clang++ -std=c++20 -fmodules -stdlib=libc++  -pedantic -Wall -fmodules-ts -c audio.cpp  -Xclang -emit-module-interface -o audio.pcm
 **** Incremental Build of configuration Default for project Modules ****
make all 
clang++ -std=c++20 -fmodules -stdlib=libc++  -pedantic -Wall -fmodules-ts -c audio.cpp  -Xclang -emit-module-interface -o audio.pcm
audio.cpp:1:10: fatal error: 'iostream' file not found

#include <iostream>
         ^~~~~~~~~~
1 error generated.
make: *** [Makefile:16: audio.pcm] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
****项目模块默认配置的增量构建****
全部
clang++-std=c++20-fmodules-stdlib=libc++-pedantic-Wall-fmodules ts-c audio.cpp-Xclang-emit模块接口-o audio.pcm
audio.cpp:1:10:致命错误:找不到“iostream”文件
#包括
^~~~~~~~~~
生成1个错误。
make:**[Makefile:16:audio.pcm]错误1
“全部启用”以退出代码2终止。生成可能不完整。

您能告诉我们您得到的确切错误吗?你的问题是包含错误输出的完整复制粘贴(作为文本)。I,那么你的安装是否可能不完整?我相信这就是问题所在。标准C包含,但标准C++标题不是。还有用于clang的include目录:/usr/include/clang/10/usr/include/clang/10/我还以为这里会有12个目录,因为我使用的是clang++v12.AFAIK clang没有附带自己的标准头。如果删除
-stdlib=libc++
标志,它会工作吗?您是否安装或构建了libc++?能否告诉我们您得到的确切错误?你的问题是包含错误输出的完整复制粘贴(作为文本)。I,那么你的安装是否可能不完整?我相信这就是问题所在。标准C包含,但标准C++标题不是。还有用于clang的include目录:/usr/include/clang/10/usr/include/clang/10/我还以为这里会有12个目录,因为我使用的是clang++v12.AFAIK clang没有附带自己的标准头。如果删除
-stdlib=libc++
标志,它会工作吗?您是否安装或构建了libc++?