如何在cygwin中使用clang ++?

时间:2015-09-17 06:47:00

标签: c++ cygwin clang

尝试跟随我的Cygwin但失败了:

$ g++ -std=c++11 a.cc

$ clang++ -std=c++11 -stdlib=libc++ a.cc
In file included from a.cc:2:
./Graph.h:4:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.

$ clang -v
clang version 3.5.2 (tags/RELEASE_352/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix

$ gcc --version
gcc (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我是否遗漏了应该在Cygwin上安装的任何库?

更新------

-v输出如下。它正在寻找正确的路径吗?

$ ll /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/iostream
-rw-r--r-- 1 abc Domain Users 2695 Mar  3  2015 /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/iostream

$ clang++ -v -std=c++11 -stdlib=libc++ a.cc
clang version 3.5.2 (tags/RELEASE_352/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-unknown-windows-cygnus -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name a.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.25 -v -dwarf-column-info -resource-dir /usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /cygdrive/c/Users/devin.huang/OneDrive/Documents/sty -ferror-limit 19 -fmessage-length 157 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/a-f26e2a.o -x c++ a.cc
clang -cc1 version 3.5.2 based upon LLVM 3.5.2 default target x86_64-unknown-windows-cygnus
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include
 /usr/include
 /usr/include/w32api
End of search list.
In file included from a.cc:2:
./Graph.h:4:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.

0 个答案:

没有答案