I'm using a Mac for development with 10.11.3
Due to Apple llvm in Xcode 7 still not supporting openmp, I have used homebrew to install a more up to date llvm/clang that does support openmp via:
$ brew tap homebrew/versions
$ brew install llvm38
I then have a very simple C++ test program, which is more or less a standard openmp test and which I know should compile:
#include <iostream>
#include <omp.h>
int main(void)
{
#pragma omp parallel for
for( unsigned v = 0; v < 15; ++v )
{
printf("thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
}
}
Installing with homebrew, it suggests that you need to specify a few extra things to successfully compile, in particular, the path to the c++ system headers that were installed from the llvm38 package. This leads me to the following command line:
/usr/local/opt/llvm38/bin/clang++-3.8 -fopenmp openmp.cpp -stdlib=libc++ -nostdinc++ -I /usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/ -L/usr/local/opt/llvm38/lib/llvm-3.8/lib
However, upon running this command, the compilation fails:
machine:tests me$ /usr/local/opt/llvm38/bin/clang++-3.8 openmp.cpp -stdlib=libc++ -nostdinc++ -I /usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/ -L/usr/local/opt/llvm38/lib/llvm-3.8/lib
In file included from openmp.cpp:1:
In file included from /usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/iostream:38:
In file included from /usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/ios:215:
In file included from /usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/iosfwd:90:
/usr/local/opt/llvm38/lib/llvm-3.8/include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
^
1 error generated.
Does anyone know how to resolve this problem and get a successful compile?