In modular programming, it is essential to set up a separate header file for a module.
In the two mainstream compilers, it is important to set the accuracy of the file path when referencing the module function, including the path to the header file.
Otherwise, the compiler will error, unable to open such a header file!
Combined with your own experience, summarize how to set the file inclusion path under these two compilations:
The first is the construction of the project, in the actual project folder, there will generally be a project folder to save the actual project, such as the creation of a folder with Project peer driver to save the driver function, driver is divided into Inc and SRC, respectively, to save the driver function of the header file and the source file, and the folder peripheral to save the peripheral driver function, peripheral file is also divided into Inc and SRC, respectively, to save the driver function of the header file and the source file.
Assumptions such as:
Assuming the existing gpio.h in the Driver\inc;
There are iic.h in the peripheral\inc;
"IAR settings include path method"
The following settings are set in the preprocessor in C + + compiler:
1 $PROJ _dir$\driver\inc 2 $PROJ _dir$\peripheral\inc
"Keil settings include Path method"
The following settings are set for Includepath in C + +:
1 .. \driver\inc2 .. \perpheral\inc
IAR and Keil files contain path settings