c++ - Clang++ 可以在 CLion 上正常工作,但不能在 VSCode 上工作
问题描述
我试图从单独的 IDE 过渡到一个可以与所有东西(Python、C++ 和 Web)一起使用的单一 IDE。我选择了 VSCode,因为它包含所有必要的东西。我完成了 Conda 和 Python 的设置,但是当我使用 C++ 时,我在编译我的 task.json 文件时遇到了问题。错误是找不到 wchar.h。它可以在 XCode 和 CLion 上编译并正常工作,但 Clang 不能在 VSCode 上工作。有想法该怎么解决这个吗?
谢谢
海杰
这是错误代码供参考
In file included from /Users/kimh2/Desktop/Coding Stuff/C++/HelloWorld/main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ios:215:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:96:
/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.
The terminal process terminated with exit code: 1
task.json 文件:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
},
{
"type": "shell",
"label": "clang++ build active file",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
解决方案
推荐阅读
- python-2.7 - python 2.7上的tox测试-> ImportError:无法导入名称ThreadingTCPServer
- java - 无法将 java.util.List 转换为模板接口的 java.lang.Iterable
- git - Git:如何创建仅显示更改的补丁文件?
- python - Python cryptodome AES-CBC / 子进程大命令输出问题
- vue.js - 为下拉列表加载 vue 脚本时出错
- lua - Lua self 方法调用尝试(一个 nil 值)
- react-native - React Native Expo 出现 Twitch API 401 错误
- php - GetChildHtml 方法为头块返回空字符串- Magento 1.9
- php - 实时服务器上的 IPN 未在 paypal 上更新表
- c++ - 类构造函数中的向量时出现运行时错误?