简体   繁体   English

intel C++ 无法在 mac osx 上打开“wchar.h”

[英]intel C++ cannot open "wchar.h" on mac osx

System OSX 10.14.6, macbook pro系统 OSX 10.14.6,macbook pro

Trying to compile this simple C++ program:尝试编译这个简单的 C++ 程序:

#include <iostream>
int main() {
    sdt::cout << "hello world" << std::endl;
    return 0;
}

Have gcc 9 installed via homebrew, as well as XCode command line tools.通过自制软件以及 XCode 命令行工具安装 gcc 9。

Both of the following work以下两项工作

c++ main.cpp
g++-9 main.cpp

Trying out the latest Intel Parallel Studio, the following fails:尝试最新的 Intel Parallel Studio,以下失败:

> icpc main.cpp 
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd(90),
                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios(215),
                 from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream(38),
                 from main.cpp(1):
/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h(119): catastrophic error: cannot open source file "wchar.h"
  #include_next <wchar.h>
                         ^

compilation aborted for main.cpp (code 4)

Can someone tell me what I am missing here?有人可以告诉我我在这里缺少什么吗?


EDIT RESPONSE TO COMMENT ABOUT find 编辑回应评论发现

searching from / for wchar.h yields many wchar.h files, including the one from the error:/搜索wchar.h产生许多 wchar.h 文件,包括错误中的文件:

 ./usr/local/Cellar/gcc/9.2.0_3/include/c++/9.2.0/tr1/wchar.h ./Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h ./Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk/System/DriverKit/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/wchar.h ./Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h ./opt/intel/intelpython3/include/c++/v1/support/solaris/wchar.h ./opt/intel/intelpython3/include/c++/v1/wchar.h ./opt/intel/intelpython3/pkgs/libcxx-4.0.1-hcfea43d_1/include/c++/v1/support/solaris/wchar.h ./opt/intel/intelpython3/pkgs/libcxx-4.0.1-hcfea43d_1/include/c++/v1/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/DriverKit19.0.sdk/System/DriverKit/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/wchar.h ./dev/fd/3/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/wchar.h ./dev/fd/3/opt/intel/intelpython3/include/c++/v1/support/solaris/wchar.h ./dev/fd/3/opt/intel/intelpython3/include/c++/v1/wchar.h ./dev/fd/3/opt/intel/intelpython3/pkgs/libcxx-4.0.1-hcfea43d_1/include/c++/v1/support/solaris/wchar.h ./dev/fd/3/opt/intel/intelpython3/pkgs/libcxx-4.0.1-hcfea43d_1/include/c++/v1/wchar.h

根据评论,这解决了问题:

icpc main.cpp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

Intel C++ compiler on macOS is highly sensitive to the version of Xcode being used. macOS 上的英特尔 C++ 编译器对所使用的 Xcode 版本高度敏感。 For example, I receive the same errors as above when using icpc 2020 Initial Release and Xcode 11.3.1, but the code compiles and executes just fine with "icpc main.cpp" when using Xcode 11.2.1.例如,我在使用 icpc 2020 初始版本和 Xcode 11.3.1 时收到与上述相同的错误,但在使用 Xcode 11.2.1 时,使用“icpc main.cpp”编译和执行代码很好。

This has been the situation with Intel C++ compilers for some time on macOS... check your Xcode version and try again.一段时间以来,英特尔 C++ 编译器一直在 macOS 上出现这种情况……请检查您的 Xcode 版本并重试。

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

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