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 ...
随机推荐
- PAT 甲级 1112 Stucked Keyboard
https://pintia.cn/problem-sets/994805342720868352/problems/994805357933608960 On a broken keyboard, ...
- PHP 常用函数总结(四)
9.PHP常用判断函数 is_bool();//判断是否为布尔型 is_float(); //判断是否为浮点型 is_int(); //判断是否为整型 is_numeric(); //判断是否为数值型 ...
- 解决方案~Microsoft Security Client OOBE 程序错误
Microsoft Security Client OOBE 程序错误 适用于: Windows Windows 7 系统错误日志如下:会话"Microsoft Security Clien ...
- IPV6 国内进展情况
国家下一代互联网产业技术创新战略联盟(以下简称“产业联盟”),近日在北京发布了我国首份IPv6业务用户体验监测报告(以下简称<报告>).该<报告>监测了我国固定宽带的IPv6普 ...
- Java override 和 overload 的区别和联系
方法的重写(Overriding)和重载(Overloading)是Java多态性的不同表现.重写(Overriding)是父类与子类之间多态性的一种表现,而重载(Overloading)是一个类中多 ...
- 数据库性能优化之SQL语句优化(下)
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效): ORACLE 的解析器按照从右到左的顺序处理FROM子句中的表名,FROM子句中写在最后的表(基础表 driving table)将被最 ...
- 【Linux笔记】ps、kill、netstat、nohup、screen
1.ps 命令,用于查看当前正在运行的进程,使用该命令可以确定有哪些进程正在运行和运行的状态.进程是否结束.进程有没有僵尸.哪些进程占用了过多的资源等等. 语法: ps [options] 示例: p ...
- 拦截器的顺序是按照xml中的顺序执行的
- Qt——数据库编程
一.概述 Qt提供了一个类似JDBC的数据库接口,需要为每个可以连接的特定数据库提供驱动程序,可以通过 QStringList QSqlDatabase::drivers() 知道当前版本的Qt哪些驱 ...
- hbase 原子操作cas
在高并发的情况下,对数据row1 column=cf1:qual1, timestamp=1, value=val1的插入或者更新可能会导致非预期的情况, 例如:原本客户端A需要在value=val ...