soa*_*dos 5 makefile g++ clang
我有一个makefile,使用g ++ 4.6可以很好地构建我的项目.
#specify the compiler
GXX=g++ -std=c++0x
# Specifiy the target
all: linkedList
# Specify the object files that the target depends on
# Also specify the object files needed to create the executable
linkedList: StudentRecord.o Node.o LinkedList.o ListMain.o
$(GXX) StudentRecord.o Node.o LinkedList.o ListMain.o -o linkedList
# Specify how the object files should be created from source files
LinkedList.o: LinkedList.cpp
$(GXX) -c LinkedList.cpp
ListMain.o: ListMain.cpp
$(GXX) -c ListMain.cpp
StudentRecord.o: StudentRecord.cpp
$(GXX) -c StudentRecord.cpp
Node.o: Node.cpp
$(GXX) -c Node.cpp
Run Code Online (Sandbox Code Playgroud)
当我将第一行更改为GXX = clang++ -std=c++0xclang时会抛出一些相当密集的错误,关于iostream在此之后没有找到正确的args或其他许多错误(但这是"root"错误).
In file included from /usr/include/c++/4.6/iostream:39:
In file included from /usr/include/c++/4.6/ostream:39:
In file included from /usr/include/c++/4.6/ios:40:
In file included from /usr/include/c++/4.6/bits/char_traits.h:40:
In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:
In file included from /usr/include/c++/4.6/bits/stl_pair.h:60:
In file included from /usr/include/c++/4.6/bits/move.h:53:
/usr/include/c++/4.6/type_traits:630:59: error: '_Tp' does not refer to a value
: public integral_constant<bool, __is_standard_layout(_Tp)>
Run Code Online (Sandbox Code Playgroud)
这是我的makefile的问题,还是这个简单的编译真的有区别吗?
使用clang 2.9.
注意: clang抱怨的是#include <iostream>
如果您使用的是 OS X Lion (10.7) 或 Mountain Lion (10.8),请使用“c++”(/usr/bin/c++),而不是直接使用“clang++”。尽管其中一个是另一个的符号链接,但 clang 有一些智能来设置正确的路径和编译器选项,以完成您在使用 C++ 时所期望的更多操作。