Because I’ve made .cpp
files and then transferred them into .h
files, the only difference I can find is that you can’t #include
.cpp
文件。我缺少什么区别吗?
原文由 user98188 发布,翻译遵循 CC BY-SA 4.0 许可协议
Because I’ve made .cpp
files and then transferred them into .h
files, the only difference I can find is that you can’t #include
.cpp
文件。我缺少什么区别吗?
原文由 user98188 发布,翻译遵循 CC BY-SA 4.0 许可协议
3 回答2k 阅读✓ 已解决
2 回答3.9k 阅读✓ 已解决
2 回答3.2k 阅读✓ 已解决
1 回答3.2k 阅读✓ 已解决
1 回答2.7k 阅读✓ 已解决
3 回答3.4k 阅读
1 回答1.6k 阅读✓ 已解决
C++ 构建系统(编译器)没有区别,所以它都是一种约定。
惯例是
.h
文件是声明,而.cpp
文件是定义。这就是为什么
.h
文件是#include
d – 我们包含声明。