我正在尝试在macOS机器(macOS Mojave 10.14.5)上使用VS代码编译一个简单的HelloWolrd(每个人都能找到的标准)C ++程序。每次尝试编译时,都会出现以下错误,告诉我wchar.h不存在。
我正在使用VS代码包C / C ++(来自Microsoft)和Code Runner(来自Jun Han)。
我(使用xcode-select --install)重新安装了Xcode,并使用conda install -c anaconda gcc安装了gcc。
In file included from /Users/../anaconda3/gcc/include/c++/bits/postypes.h:40:0,
from /Users/../anaconda3/gcc/include/c++/iosfwd:40,
from /Users/../anaconda3/gcc/include/c++/ios:38,
from /Users/../anaconda3/gcc/include/c++/ostream:38,
from /Users/../anaconda3/gcc/include/c++/iostream:39,
from HelloWorld.cpp:1:
/Users/../anaconda3/gcc/include/c++/cwchar:44:19: fatal error:
wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated.
之前在这里讨论过类似的问题(http://stackoverflow.com/questions/19575956/building-c-not-working-in-osx-10-9) 非常感谢您的帮助和耐心。
我要运行的代码:
#include <iostream>
int main()
{
std::cout << "Hello World!";
return 0;
}