Makefile一 头文件及库搜索路径
头文件及库搜索路径
头文件的搜索路径:
头文件的搜索规则是:找到就使用,停止继续往下寻找
1: #include “mytest.h”
搜索的顺序为:
(1)先搜索当前目录
(2)然后搜索编译时 -I 指定的目录
(3)在搜索gcc的环境变量CPLUS_INCLUDE_PATH
(4)最后搜索gcc内定的目录
/usr/include
[root@centos-64-min include]# ls /usr/include/
aio.h ftw.h neteconet stab.h
aliases.h _G_config.h netinet stdint.h
alloca.h gconv.h netipx stdio_ext.h
a.out.h getopt.h netiucv stdio.h
argp.h glob.h netpacket stdlib.h
argz.h gnu netrom string.h
ar.h gnu-versions.h netrose strings.h
arpa grp.h nfs sys
asm gshadow.h nl_types.h syscall.h
asm-generic iconv.h nss.h sysexits.h
assert.h ieee754.h obstack.h syslog.h
bits ifaddrs.h paths.h tar.h
byteswap.h inttypes.h poll.h termio.h
c++ langinfo.h printf.h termios.h
complex.h lastlog.h protocols tgmath.h
cpio.h libgen.h pthread.h thread_db.h
crypt.h libintl.h pty.h time.h
ctype.h libio.h pwd.h ttyent.h
dirent.h limits.h python2.6 ucontext.h
dlfcn.h link.h rdma ulimit.h
drm linux re_comp.h unistd.h
elf.h locale.h regex.h ustat.h
endian.h malloc.h regexp.h utime.h
envz.h math.h resolv.h utmp.h
err.h mcheck.h rpc utmpx.h
errno.h memory.h rpcsvc values.h
error.h mntent.h sched.h video
execinfo.h monetary.h scsi wait.h
fcntl.h mqueue.h search.h wchar.h
features.h mtd semaphore.h wctype.h
fenv.h net setjmp.h wordexp.h
fmtmsg.h netapi.h sgtty.h xen
fnmatch.h netash shadow.h xlocale.h
fpu_control.h netatalk signal.h
fstab.h netax25 sound
fts.h netdb.h spawn.h
/usr/local/include
当前该目录下没有文件
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include
[root@centos-64-min local]# ls /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/
abmintrin.h float.h nmmintrin.h syslimits.h
ammintrin.h fma4intrin.h omp.h tbmintrin.h
avxintrin.h immintrin.h pmmintrin.h tmmintrin.h
bmiintrin.h iso646.h popcntintrin.h unwind.h
bmmintrin.h limits.h smmintrin.h varargs.h
cpuid.h lwpintrin.h stdarg.h wmmintrin.h
cross-stdarg.h mm3dnow.h stdbool.h x86intrin.h
emmintrin.h mmintrin.h stddef.h xmmintrin.h
f16cintrin.h mm_malloc.h stdfix.h xopintrin.h
2:#include <stdio.h>
搜索顺序为:
(1)先搜索 -I 指定的目录
(2)然后搜索gcc的环境变量CPLUS_INCLUDE_PATH
(3)最后搜索gcc内定目录,上面三个
待续...
Makefile一 头文件及库搜索路径的更多相关文章
- linux 头文件以及库的路径
原来在编译的时候可以指定执行时去哪里找需要的lib文件,长知识了 本文详细介绍了Linux 下gcc头文件指定方法,以及搜索路径顺序的问题.另外,还总结了,gcc动态链接的方法以及路径指定,同样也讨论 ...
- 环境变量,include搜索路径,lib库搜索路径
环境变量 系统环境变量 我们知道,我们经常要设置一些环境变量,系统环境变量我们非常容易理解.其实我们在windows中经常容易接触.其实环境变量是一个非常广泛的一个概念,它与web应用程序中的web. ...
- linux下的头文件和库文件搜索路径 (转)
GCC 找头文件有三种策略: 1. 会在默认情况下指定到 /usr/include 文件夹 ( 更深层次的是一个相对路径, GCC 可执行程序的路径是 /usr/bin ,那么它在实际工作时指定头文 ...
- gcc编译时头文件和库文件搜索路径
特殊情况:用户自定义的头文件使用#include"mylib"时,gcc编译器会从当前目录查找头文件 一.头文件 gcc 在编译时寻找所需要的头文件 : ※搜寻会从-I开始( ...
- linux下gcc默认搜索头文件及库文件的路径
一.头文件gcc 在编译时如何去寻找所需要的头文件:※所以header file的搜寻会从-I开始※然后找gcc的环境变量 C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC ...
- linux gcc 编译时头文件和库文件搜索路径
一.头文件 gcc 在编译时寻找所需要的头文件 : ※搜寻会从-I开始 ※然后找gcc的环境变量 C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC_INC ...
- linux下gcc默认搜索的头文件及库文件路径
转自:https://blog.csdn.net/fd315063004/article/details/7925854 一.头文件 gcc 在编译时如何去寻找所需要的头文件:※所以header fi ...
- C/C++ 头文件以及库的搜索路径
关键点: 1. #include <...> 不会搜索当前目录 2. 使用 -I 参数指定的头文件路径仅次于 搜索当前路径. 3. gcc -E -v 可以输出头文件路径搜索过程 C++编 ...
- gcc的搜索路径,头文件和库
1 抛开默认的搜索路径,自己指定搜索路径 第一,明确自己编写的代码所需要的头文件和库放在了哪里 第二,使用“-I”指定头文件的搜索路径,使用-rpath指定库的搜索路径 2 无论是本地编译还是交叉编译 ...
随机推荐
- iOS 循环轮播框架思路
使用3个imageview实现无线轮播的大致原理 将3个imageview添加到scrollview上面,scrollview的contensize是3个imageview的宽度,设置scrollvi ...
- python学习笔记1.3
温度转换实例 #TempConvert.pyTempStr = input("请输入带有符号的温度值: ")if TempStr[-1] in ['F', 'f']:C = (ev ...
- python super()继承和多继承
class A: def __init__(self): self.n = 2 def add(self, m): print('self is {} @A.add'.format(self)) se ...
- centos的基本命令01
01:创建用户命令 useradd liulaoshi # 创建用户 passwd liulaoshi # 设置密码, 回车后会提示让你输入两次密码 1.用户列表文件:/etc/passwd/ 2.用 ...
- spring测试save方法报错
用test类测试service的save方法时,报错如下: 2018-08-24 21:52:13,506 - could not read a hi value com.mysql.jdbc.exc ...
- SPOJ 1811 Longest Common Substring(求两个串的最长公共子串 || 或者n个串)
http://www.spoj.com/problems/LCS/ 题目:求两个串的最长公共子串 参考:https://www.cnblogs.com/autoint/p/10345276.html: ...
- Android调用 .Net Core WebApi 返回数据,用FastJSON解析一直报错。
问题描述:.Net Core WebApi中用Newtonsoft.Json 把datatable转成json字符串,如:JsonConvert.SerializeObject(table,Forma ...
- iis上部署本地数据库LocalDB的方法
1. iis应用程序池的标识设置为"ApplicationPoolIdentify"(比较安全) 2. 不要将数据库物理文件保存在网站的物理路径内,因为iis应用程序池的标识为Ap ...
- Linux and Shell 实用命令
-name '*.jar' -printf '%p:' ### 查看CPU使用率 mpstat -P ALL
- es第二篇:Document APIs
文档CRUD API分为单文档API和多文档API.这些API的索引名参数既可以是一个真正的索引的名称,也可以是某个索引的别名alias. 单文档API有:Index API.Get API.Dele ...