clang编译
hello.c :最初的源代码文件
hello.i:经过预编译处理的源代码
hello.s:汇编处理后的汇编代码
hello.o:编译后的目标文件,即含有最终编译出的机器码,但它里面所引用的其他文件中函数的内存位置尚未定义
hello / a.out :最终可执行文件
添加 -v 命令查看搜索路径![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/ae1b136e21c7609892cfc11b013e47f4.png)
搜索路径:
#include<file.h>只在默认的系统包含路径搜索头文件
#include”file.h”首先在当前目录搜索头文件,若头文件不位于当前目录,则到系统默认的包含路径搜索头文件
UNIX类系统默认的系统路径为:
头文件,包含路径:/usr/local/include or .usr/include
库文件,连接路径:/usr/local/lib or /usr/lib
clang -cc1 找不到头文件
clang -cc1选项默认在自己的目录搜索
对于.c文件,-I 添加搜索路径
$ clang -cc1 -I/usr/include/ -I/usr/lib/gcc/x86_64-linux-gnu/4.8/include + 其他命令
对于.c文件,-I 添加搜索路径
$ clang -cc1 -I /usr/include/c++/9 -I /usr/include/x86_64-linux-gnu/c++/9 -I /usr/include/ -I /usr/lib/gcc/x86_64-linux-gnu/9/include/ -analyze -analyzer-checker=debug.ViewExplodedGraph hellocpp.cpp -v
如何将路径永久的添加系统中(例如添加环境变量等),而不改变clang默认的搜索路径,只改变clang -cc1的搜索路径?如有知道的同学,还烦请告知一下,谢谢