1 Application programming, header files in driver source code
1.1 The header file included in application programming is the header file of the application layer, which is brought by the compiler of the application
1.1.1 When compiling applications under Windows
1) The header files included with <> generally search the path after the -I option (that is, the -I option when compiling with gcc), and then the standard system header file path.
2) The header files included with the "" sign will first search the current working directory, and the search path after that is the same path as the header file included with the <> sign. 3) When compiling programs of X86 architecture
in linux system, the default standard header file path is:
The following is the default header file path I got using cpp -v in linux under ubuntu
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
1.1.2 When compiling applications for ARM architecture
1) When compiling programs of ARM architecture in linux system , the general default standard header file path is:
The following is my linux under ubuntu, using arm-hisiv300-linux-cpp -v to get the path
/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/include
/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../target/usr/include
2) Specify by using -I etc. in the makefile
See porting of libjpeg library
3) For example, on the HiSilicon platform, you need to use a cross-compilation tool to compile applications that can be used on the HiSilicon development board, as follows:
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
Use find -name "stat.h" on the Linux command line (note: use root user permissions to search in the topmost directory)
./opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/usr/include/sys/stat.h
Summary: Compilation toolchains of different versions are written for their own platforms, such as an executable program gcc, arm-hisiv300-linux , arm-x210-linux-gcc in the toolchain. When the toolchain is installed, it contains There are all the header files required for compilation. The path to find the header files by default is where you installed them. As mentioned above, all we need to modify CC = arm-xxx-xxx in the makefile, etc., only when making Will use our specified cross-compilation toolchain.