why inline functions must be put in header files?
[why inline functions must be put in header files?]
编译中有2个过程:compile、link。先进行compile,compile中把源代码编译成目标代码(.obj),然后是link,把目标代码(obj)中的外部符号替换为真实的地址。
inline函数的作用是减少函数调用而直接使用函数内部内容,显示是发生在compile阶段。所以如果把inline函数放在cc文件中,则compile过程中无法实现inline效果,连接器将给出 “unresolved external” 。
事实上,inline一个函数,也意味着给该函数加上了static标签。
参考:http://www.cnblogs.com/mydomain/archive/2013/04/06/3001859.html
why inline functions must be put in header files?的更多相关文章
- Inline functions
Problems: (Page 372) There are two problems with the use of proprocessor macros in C++. The first is ...
- C++对象模型——Inline Functions(第四章)
4.5 Inline Functions 以下是Point class 的一个加法运算符的可能实现内容: class Point { friend Point operator+(const Poin ...
- 解决Cannot find MySQL header files under /usr/include/mysql的错误
按照下面的步骤能成功,亲测.转帖,做笔记 编译php-5.5-6的mysql支持,出现Cannot find MySQL header files under /usr/include/mysql. ...
- TN035: Using Multiple Resource Files and Header Files with Visual C++
TN035: Using Multiple Resource Files and Header Files with Visual C++ This note describes how the Vi ...
- VC中Source Files, Header Files, Resource Files,External Dependencies的区别
VC中Source Files, Header Files, Resource Files,External Dependencies的区别 区别: Source Files 放源文件(.c..cpp ...
- 编译安装php Cannot find MySQL header files under /usr/include/mysql.
编译php-5.5-6的mysql支持,出现Cannot find MySQL header files under /usr/include/mysql. Note that the MySQL c ...
- Unable to find the ncurses libraries or the required header files解决
问题: 解决方法: sudo apt-get install ncurses-dev 参考:Unable to find the ncurses libraries or the required h ...
- 编译安装php时提示Cannot find MySQL header files的解决方法
php的配置文件中有一行--with-mysql=/usr/local/mysql ,安装的时候提示:configure: error: Cannot find MySQL header files ...
- [转载]C header files matching your running
原文地址:C header files matching your running kernel were not found.作者:[Opser]小默 c header files matching ...
随机推荐
- JAVA自学日记——Part Ⅱ
今天学习了类与对象,其中关于this关键字的用法,static静态变量与静态方法,以及引用传递需要特别注意一下. 首先是引用传递: 在本段程序中可以通过进行外部对类对象的属性赋值来更改,同时也可以通过 ...
- 深入理解Java类加载器(3)
5.2 网络类加载器 下面将通过一个网络类加载器来说明如何通过类加载器来实现组件的动态更新.即基本的场景是:Java 字节代码(.class)文件存放在服务器上,客户端通过网络的方式获取字节代码并执行 ...
- CodeM Qualifying Match Q1
问题描述: 具体地说,就是在第二段音频中找到一个长度和第一段音频相等且是连续的子序列,使得它们的 difference 最小.两段等长音频的 difference 定义为: difference = ...
- Enterprise Library 2.0 参考源码索引
http://www.projky.com/entlib/2.0/Microsoft/Practices/EnterpriseLibrary/Caching/BackgroundScheduler.c ...
- vue 中使用better-scroll 遇到的问题
以下是遇到问题以及解决方法 1.使用v-for 循环循环出来的列表,不能滚动. 原因是没有给wrapper 父层 加高度,当子层的高度大于父层的高度,才能滚动 打印scroll 对象,显示如此 竟然相 ...
- Mongodb compass 介绍
参考官方文档:https://docs.mongodb.com/compass/current/install/#install-on-red-hat-enterprise-linux-rhel Mo ...
- jQ 小球碰撞检测
<!doctype html> <html> <head> <meta charset="UTF-8"> <title> ...
- syntax error:unexpected end of file
将window上编辑的xxy1.sh脚本上传到linux上,并执行的时候提示 xxy1.sh: line 17: syntax error: unexpected end of file 但是通过ca ...
- 常见meta标签记录
关于meta <meta> 元素可提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词. <meta> 标签位于文档的头部,不包含 ...
- 用JavaScript添加选择按钮的背景颜色和juqery添加选择按钮的背景色
在项目开发中经常遇到要选择的按钮,选择完之后被选择的按钮的背景色会发生变化,表示被选择 样式图如下: 每点击一个数字,相应的背景色变为蓝色,其他的依旧是白色,先用JavaScript实现 html代码 ...