Includes not found for clang ++ + OpenMP + stdlibc ++

I followed an excellent step-by-step guide to compiling clang (++) with OpenMP support for Mac OS X found here . However, when compiling a simple test program:

#include <iostream>

int main(int argc, char** argv)
{
    std::cout << "Hello world!" << std::endl;
    return 0;
}

      

... I just get:

$> clang2++ -Wall -std=c++11 -stdlib=libc++ -fopenmp -o openmp openmp.cpp 
openmp.cpp:2:10: fatal error: 'iostream' file not found
#include <iostream>

      

My newly compiled clang project doesn't seem to include libc ++ and even if standard directories are included ("standard" afaik), ie:

/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)

      

... it still doesn't work. Has anyone else encountered this and found a solution? Thank.

+3


source to share


2 answers


I have successfully compiled clib ++ adding the missing step to the Clang / OpenMP build routine.

The Clang / OpenMP page ( http://clang-omp.github.io/ ) prompts you to download: -

$ git clone https://github.com/clang-omp/llvm
$ git clone https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt
$ git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang

      



If you want to enable C ++ 11 support you should also download: - $ git clone https://github.com/llvm-mirror/libcxx llvm / projects / libcxx

One of the build options is LLVM_EXTERNAL_LIBCXX_SOURCE_DIR (defined in CMakeCache.txt), which libcxx expects at this location.

* Note. I had to make small changes to the build instructions mentioned in the Kyle Halladays OSX Mavericks instructions, replacing: .. / configure --enable-optimized with .. / configure --enable-optimized CC = / usr / bin / clang CXX = / usr / bin / clang ++

+1


source


ok you can include the directory containing iostream clang2 ++ -std = c ++ 11 -stdlib = libc ++ -fopenmp -o openmp openmp.cpp -I / usr / include



if / usr / include contains an iostream file

0


source







All Articles