【发布时间】:2013-08-13 20:32:14
【问题描述】:
在编译包含 main.cpp、pattern.cpp 和 pattern.h 的 C++ 程序时(包含两个函数声明但没有类的头文件;这些函数在 pattern.cpp 中定义并且 main.cpp 包含 #include "pattern .h" 在顶部)通过键入:
clang++ main.cpp
错误信息是:
/tmp/cc-nrPup0.o: In function `main':
main.cpp:(.text+0x69): undefined reference to `pattern(int, int)'
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
我该如何解决这个问题?我尝试输入 -v,但 clang 输出已终止,这是一个无效命令
【问题讨论】:
-
显示您用于构建问题的命令。
标签: c++ gcc compilation clang++