C ++中的头文件和库文件之间有什么关系? [英] What's the relationship between header files and library files in c++?

查看:89
本文介绍了C ++中的头文件和库文件之间有什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们为什么需要同时将include和libs添加到编译中?

Why do we need to add both includes and libs to the compilation?

为什么libs没有将所有内容都包裹在其中?

Why doesn't the libs wrap everything in it?

推荐答案

头文件(通常)仅包含类和函数的声明.实际的实现是从CPP文件构建的.然后,您可以仅使用标题声明来链接这些实现.

A header file (usually) only contains declarations for classes and functions. The actual implementations are built from CPP files. You can then link against those implementations with only the header declarations available.

这篇关于C ++中的头文件和库文件之间有什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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