Why won’t this simple C++ code compile with clang++?

This question already has an answer here:

  • What is an undefined reference/unresolved external symbol error and how do I fix it? 27 answers

  • 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

    链接地址: http://www.djcxy.com/p/86340.html

    上一篇: Xcode C ++ ::体系结构x86的重复符号

    下一篇: 为什么不能用clang ++编译这个简单的C ++代码?