繁体   English   中英

致命错误:wchar.h:没有这样的文件或目录

[英]fatal error: wchar.h: No such file or directory

当我尝试执行 c++ 代码时出现以下错误

In file included from /usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/bits/postypes.h:40,
                 from /usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/iosfwd:40,
                 from /usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/ios:38,
                 from /usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/ostream:38,
                 from /usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/iostream:39,
                 from main.cpp:1:
/usr/local/Cellar/gcc/10.2.0_3/include/c++/10.2.0/cwchar:44:10: fatal error: wchar.h: No such file or directory
   44 | #include <wchar.h>
      |          ^~~~~~~~~
compilation terminated.

我在 MacOS Big Sur 11.2 上使用 gcc10 编译器工作正常,直到我更新自制软件或更新到 Big Sur 11.2。 运行 brew cleanup 也可能会破坏它。 我尝试再次取消链接和链接 gcc 但没有效果。 我能做些什么来解决这个错误? 删除并重新安装gcc会更好吗?

通过更新我的 xcode 命令行工具解决了这个问题

我也有同样的问题,这是我使用的命令

g++-11 -std=gnu++20 -std=c++20 code.cpp -o code && gtimeout 4s ./code<inputf.in>outputf.in

需要帮忙 !!

暂无
暂无

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

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