.cpp文件和.h文件之间有什么区别? [英] What is the difference between a .cpp file and a .h file?

查看:166
本文介绍了.cpp文件和.h文件之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我做了.cpp文件,然后将它们转换为.h文件,唯一的区别,我可以发现是你不能#include .cpp文件。有没有什么不同,我缺少?

Because I've made .cpp files then transfered them into .h files, the only difference I can find is that you can't #include .cpp files. Is there any difference that I am missing?

推荐答案

C ++构建系统(编译器)没有什么区别,约定。

The C++ build system (compiler) knows no difference, so it's all one of conventions.

约定是.h文件是声明,而.cpp文件是定义。

The convention is that .h files are declarations, and .cpp files are definitions.

为什么.h文件是#included - 我们包括声明。

That's why .h files are #included -- we include the declarations.

这篇关于.cpp文件和.h文件之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆