当前位置:网站首页>Header file search rules when compiling with GCC
Header file search rules when compiling with GCC
2022-08-05 10:19:00 【small husk】
1, GCC search header file rules
First, gcc will look for the required header files from the current directory, usually user-defined header files.
gcc will search for header files according to the header file path specified by the -I parameter, as follows, the header file path is /usr/openwin/include, and /srv/lib is the dynamic library path.
gcc -I /srv/include -L /srv/lib hello.c
gcc finds the required header files from its own environment variables C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH
Find the required header files from the default directory /usr/include /usr/local/include /usr/lib/gcc-lib/i386-li.
If neither can be found, an error will be reported.
2. Specify the header file path in the makefile
#path to the compilerCC= /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc#Specify the header file path, prompting warning compilation,CFLAGS=-Wall -I/home/develop/include#source file pathSRCS=main.c sum.c com.c#dynamic library pathLIBS=-L /usr/lib#Specify the target file, all .c files are renamed to .o files (retain the characters at %, and the rest of the characters should be replaced)OBJS=$(SRCS:%.c=%.o)#Specify the name of the executable fileEXECUTABLE=ssj_flyfish#Compile and generate object files$(EXECUTABLE):$(CC) -o $(EXECUTABLE) $(CFLAGS) $(SRCS) $(LIBS)
边栏推荐
- 第六章:activiti流程分流判断之排它网关和并行网关
- 第四章:redis 数组结构的set和一些通用命令「建议收藏」
- FPGA: Use of the development environment Vivado
- How does the official account operate and maintain?Public account operation and maintenance professional team
- MySQL transactions
- 语音社交软件开发——充分发挥其价值
- Microcontroller: temperature control DS18B20
- 华为轻量级神经网络架构GhostNet再升级,GPU上大显身手的G-GhostNet(IJCV22)
- STM32+ULN2003驱动28BYJ4步进电机(根据圈数正转、反转)
- 012_SSS_ Improving Diffusion Model Efficiency Through Patching
猜你喜欢
随机推荐
Common operations of oracle under linux and daily accumulation of knowledge points (functions, timed tasks)
浅析WSGI协议
教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!
DFINITY 基金会创始人谈熊市沉浮,DeFi 项目该何去何从
What are the standards for electrical engineering
Analysis and practice of antjian webshell dynamic encrypted connection
【 temperature warning program DE development 】 event driven model instance
使用工具类把对象中的null值转换为空字符串(集合也可以使用)
GCC编译的时候头文件搜索规则
第六章:activiti流程分流判断之排它网关和并行网关
5. Deploy the web project to the cloud server
Microservice Technology Stack
The host computer develops C# language: simulates the STC serial port assistant to receive the data sent by the microcontroller
Go compilation principle series 6 (type checking)
hcip BGP enhancement experiment
牛刀小试基本语法,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang基本语法和变量的使用EP02
阿里全新推出:微服务突击手册,把所有操作都写出来了PDF
还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!
The query that the user's test score is greater than the average score of a single subject
单片机:温度控制DS18B20