STM32 same path problem header file name

I do not know if you have not encountered such a situation, the same project there are two header files are in a different path, two paths are also added to your project inside that #include c in a document which "xxx after .h ", the system header files which will be added? Add or both? Bloggers test results: adding headers to sort last.

For example, in the following project, it contains two rng.h and rng.c file (a CUBEMX is automatically generated, and the other is looking for bloggers third-party libraries, provided punctuality atom).

Then, if you #include "rng.h" c in a file, the system will only add to the path of rng.h included into the path of the former that is sorted in the following figure.

There are two ways to solve the above problems.

Method 1: time to add header files to specify detailed paths. As shown in the following code:

#include "tim.h"
#include "usart.h"
#include "sys.h"
#include "lcd.h"
#include "string.h"
#include "..\Hardware\rng.h"
#include "..\Hardware\rtc.h"

Some header files can be directly referenced in the project because they are unique, but some can be refined path references to header files.

Method 2: Modify the header file name

This approach is not to say, directly on the map it should be understood at a glance. Just one thing to note, after modification, the original call path have to follow the changes.

You can add a prefix of the class in the header file source file before you choose a third-party libraries, so that you can avoid the problem header files with duplicate names. While under the above figure Hardware and Application / User files have never had the same name as the file.

 

Guess you like

Origin www.cnblogs.com/showtime20190824/p/11410052.html