I'm running macOS Catalina 10.15.3, Xcode 11.3.1 (all is a fresh install, new computer) with Intel C++ 2020 Initial Release. When trying to compile the simple program "main.cpp" :
- - - - - - -
#include <iostream> int main() { std::cout << "hello world"<< std::endl; return 0; }
- - - - - - - -
with the command "icpc main.cpp" I get the following error:
- - - - - - - -
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd(96), 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)
- - - - - - - -
The error goes away and the code compiles fine when I use: "icpc main.cpp -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
How come Intel doesn't ship these headers so that the compiler is self-contained? I'm executing the compilervars script when I launch my terminal, why is this directory not set? Is there a way around setting sysroot when compiling? This was also address in stack overflow, but no alternative solution was proposed:
https://stackoverflow.com/questions/59938881/intel-c-cannot-open-wchar-h...
Thanks -
Mike