使用clang ++和cuda sdk编译时无法找到标准C ++库

时间:2016-01-28 09:09:19

标签: c++ llvm clang++ libstdc++

我正在尝试使用clang ++编译cuda程序。我按照Clang's Instructional Page提供的说明进行操作。

但是,尝试使用以下命令发出编译时,

$ clang++ -v  -I $CUDA/samples/common/inc/ -L $CUDA/lib/ -I $CUDA/include/ axpy.cu -lcudart_static -lcuda -ldl -lrt -pthread -lstdc++

我正面临一条错误消息:

In file included from /opt/cuda//samples/common/inc/helper_cuda.h:24:
/opt/cuda//samples/common/inc/helper_string.h:18:10: fatal error: 'fstream' file not
  found
#include <fstream>
         ^

特别是,当我尝试使用与cc代码相同的库编译虚拟程序时,它会顺利通过,没有任何错误。

我在下面列出了版本信息:

$ clang++ -v
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

我目前正在/opt/cuda安装使用clin的archlinux。

更新

通过明确设置CPATH指向CPATH=/usr/include/c++/5.3.0/:/usr/include/c++/5.3.0/x86_64-unknown-linux-gnu/:/usr/include/c++/5.3.0/x86_64-unknown-linux-gnu/32/:

,我能够让编辑更进一步

但是,现在我面临其他形式的错误:

/usr/include/c++/5.3.0/cwchar:146:11: error: no member named 'fwide' in the global
  namespace
using ::fwide;
    ~~^

0 个答案:

没有答案