我在 OS X 中编码这是我的 Makefile:
#makefile for stack_5_1
# Yitong Zhou
stack_5 : main.o Stack.o LIFO_Stack.o Peekback_Stack.o
g++ -o stack_5 main.o Stack.o LIFO_Stack.o Peekback_Stack.o
main.o: main.cpp Stack.h LIFO_Stack.h Peekback_Stack.h
g++ -c main.cpp
Stack.o: Stack.cpp Stack.h
g++ -c Stack.cpp
LIFO_Stack.o: LIFO_Stack.cpp LIFO_Stack.h
g++ -c LIFO_Stack.cpp
Peekback_Stack.o: Peekback_Stack.cpp Peekback_Stack.h
g++ -c Peekback_Stack.cpp
clean:
rm -rf *.o stack_5
错误:
..... // very very long
Dwarf Exception Unwind Info (__eh_frame) in Stack.o
Dwarf Exception Unwind Info (__eh_frame) in LIFO_Stack.o
Dwarf Exception Unwind Info (__eh_frame) in Peekback_Stack.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [stack_5] Error 1
gcc 和 g++ 有什么区别?为什么我用 gcc 替换 g++ 时编译失败?
顺便说一句,我如何确保我的 makefile 可以在 Cygwin、linux、OS X 和其他环境中正确运行。