Linux C include路径问题
2016-01-25 11:04
302 查看
In c/c++ program, if we need include file,there are two ways:
Include <> or
Include “”
When we use include <>
The search order:
1 search “-I” target directory ifwe used in GCC command
2 search the directory defined in“CPLUS_INCLUDE_PATH”(c++) or “C_INCLUDE_PATH”(c) cenvironment variable
3 search GCC built-inpath: /usr/include /usr/local/include /usr/lib/gcc/i686-redhat-linux/<version>/include
When we use include “ ”
1 search current directory, (echo$PWD)
2 search “-I” target directory ifwe used in GCC command
3 search the directory defined in“CPLUS_INCLUDE_PATH”(c++) or “C_INCLUDE_PATH”(c) or “CPATH”(both c and c++)environment variable
4 search GCC built-inpath: /usr/include /usr/local/include /usr/lib/gcc/i686-redhat-linux/<version>/include
to verify, we can use gcc –v test.c toprint the build progress, we can find the result from the output.
Useful link:
http://www.360doc.com/content/13/0524/16/110467_287784511.shtml
http://blog.sina.com.cn/s/blog_6fe0d70d0101ep85.html
tips:
GCC built-in include path prefix(marked byred, means where GCC is installed ) can be found:
Gcc –v
Configured with:../configure --prefix=/usr--mandir=/usr/share/man --infodir=/usr/share/info
Include <> or
Include “”
When we use include <>
The search order:
1 search “-I” target directory ifwe used in GCC command
2 search the directory defined in“CPLUS_INCLUDE_PATH”(c++) or “C_INCLUDE_PATH”(c) cenvironment variable
3 search GCC built-inpath: /usr/include /usr/local/include /usr/lib/gcc/i686-redhat-linux/<version>/include
When we use include “ ”
1 search current directory, (echo$PWD)
2 search “-I” target directory ifwe used in GCC command
3 search the directory defined in“CPLUS_INCLUDE_PATH”(c++) or “C_INCLUDE_PATH”(c) or “CPATH”(both c and c++)environment variable
4 search GCC built-inpath: /usr/include /usr/local/include /usr/lib/gcc/i686-redhat-linux/<version>/include
to verify, we can use gcc –v test.c toprint the build progress, we can find the result from the output.
Useful link:
http://www.360doc.com/content/13/0524/16/110467_287784511.shtml
http://blog.sina.com.cn/s/blog_6fe0d70d0101ep85.html
tips:
GCC built-in include path prefix(marked byred, means where GCC is installed ) can be found:
Gcc –v
Configured with:../configure --prefix=/usr--mandir=/usr/share/man --infodir=/usr/share/info
相关文章推荐
- linux增加swap空间
- 利用wireshark抓取远程linux上的数据包
- linux 重命名文件和文件夹
- 库会因为权限问题无法打开——selinux开启严格模式
- linux ss 命令详解
- 文石(onyx boox M92)电纸书(linux) 下写绘图板程序Mypainter.oar
- VLAN device for 802.1.q on Linux
- linux上很方便的上传下载文件工具rz和sz
- Linux系统下如何查看物理内存占用率
- linux下移动或者复制文件覆盖相同文件夹时,文件夹里面的每个文件都提示是否覆盖
- Linux Source命令及脚本的执行方式解析
- 如何在CentOS 5/6/7上安装EPEL 源
- Linux防火墙(iptables)的开启与关闭
- Linux chmod命令详解
- c中定义变量的内存分配顺序问题(极易错!!!)
- 通过 ulimit 改善系统性能
- linux mysql目录迁移
- 多功能的U盘启动盘制作工具
- 【linux j2ee环境搭建】之三:mysql安装
- LinuxThreads 和 NPTL