栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

#include 作用

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

#include 作用

#include 是一个预处理指令,作用是寻找指令后面<>或“”中的文件名,并把这个文件的内容包含到当前的文件中,被包含的文件中的文本将替换源代码文件中的#include指令。

注意:#include 后面也可以不是头文件。

如:

// test.h
int a = 2;
// test.txt
1235678
// main.c
#include "test.h"
#inlcude "test.txt"
int main()
{
	return 0;
}

gcc -E main.c -o main.txt 预编译,查看main.txt:

# 1 "main.c"
# 1 ""
# 1 ""
# 1 "main.c"
# 1 "test.h" 1

int a = 3;
# 2 "main.c" 2
# 1 "test.txt" 1
1234
# 3 "main.c" 2
int main()
{
    return 0;
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/665095.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号