Why won’t this simple C++ code compile with clang++?
This question already has an answer here:
main.cpp
includes test.h
; it does not include test.cpp
. You can compile and link them at the same time by specifying them both as input:
[test]$ clang++ main.cpp test.cpp -o main
你错过了其他的cpp文件: clang++ main.cpp test.cpp -o main