首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >‘致命错误:'wchar.h’文件未找到‘与新的macos 11.3更新错误

‘致命错误:'wchar.h’文件未找到‘与新的macos 11.3更新错误
EN

Stack Overflow用户
提问于 2021-04-28 15:25:32
回答 1查看 1.7K关注 0票数 2

我对c++完全陌生(从那天开始从零开始学习)。今天我把这个macos更新到11.3,现在当我在clion中运行我的c++代码时,我得到了这个错误,

代码语言:javascript
运行
复制
====================[ Build | untitled | Debug ]================================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/nibin/CLionProjects/untitled/cmake-build-debug --target untitled -- -j 6
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk' [-Wmissing-sysroot]
In file included from /Users/nibin/CLionProjects/untitled/main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:37:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:214:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:95:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.
make[3]: *** [CMakeFiles/untitled.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2

我在网上搜索,但一个字也不懂。我试过了,在我的终端机里找到了这个,

代码语言:javascript
运行
复制
➜  ~ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
➜  ~ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
➜  ~ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password:
➜  ~ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

我已经有了xcode工具,而且它是最新的。我尝试了其中一个解决方案,就是改变路径,但仍然没有奏效。所以我把文件带回原来的位置,

代码语言:javascript
运行
复制
➜  ~ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
➜  ~ xcrun --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

我尝试了另一种解决方案,结果出错了,

代码语言:javascript
运行
复制
➜  ~ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
The file /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg does not exist.

我打开了/Library/Developer/CommandLineTools/我得到了这个

代码语言:javascript
运行
复制
➜  ~ cd /Library/Developer/CommandLineTools
➜  CommandLineTools ls
Library SDKs    usr

一些涉及清除缓存的解决方案“删除当前项目和依赖项中的任何旧CMakeCache.txt并重新构建解决了问题。”对不起,这听起来很傻,但我不太明白。这是否意味着我们必须删除整个文件CMakeCache.txt,还是只删除内容。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-07 11:00:22

“我们认为Tools | CMake | Reset Cache and Reload project在这种情况下应该有所帮助。”(https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000919219-Clion-can-t-compile-because-of-wchar-h-not-found-after-updated-Mojave-in-mac-),这对我很有帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67303146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档