1. First of all, you must clearly understand the meaning of the project setting path. Why do you set this path instead of another one? What is the reason for setting it? Answer: The project setting path is to search for *.h files.
The picture below shows my project path, where the User folder is used to store files that I need to write or modify.
Let's take a look at the files in the User path. The three .c files and two .h files are copied from the STM32F10x_StdPeriph_Lib_V3.5.0ProjectSTM32F10x_StdPeriph_ExamplesSDIO path of the official library.
STM32_EVAL stores the files copied from the official library.
stm32_eval.c
stm32_eval.h
stm32_eval_sdio_sd.c
stm32_eval_sdio_sd.h
stm3210e_eval.c
stm3210e_eval.h
There are 6 files in total. Let's ignore this folder for now.
At this time, compile and you will be prompted
..Userstm32f10x_it.c(26): error: #5: cannot open source input file "stm32_eval_sdio_sd.h": No such file or directory
..Usermain.c(24): error: #5: cannot open source input file "stm32_eval_sdio_sd.h": No such file or directory
As shown below:
A careful observation will reveal that stm32f10x_it.c and main.c prompt that stm32_eval_sdio_sd.h cannot be found.
Why are there two file prompts? We observed that the header file stm32_eval_sdio_sd.h is referenced at the top of main.c and stm32f10x_it.c, as shown in the figure below:
Oh, it turns out that the .c file references the .h file, and an error is reported if the .h file cannot be found. stm32f10x_it.c also references stm32f10x_it.h? Then why is there no error? See the following figure for the reason:
We store stm32f10x_it.h in the User path, and stm32f10x.c can find stm32f10x.h so no error is reported.
stm32f10x_it.c references stm32f10x.h and stm32_eval_sdio_sd.h. Why can it find stm32f10x.h but not stm32_eval_sdio_sd.h?
Finally, I'm getting to the point. This is what I want to talk about, how to set the include path in the C/C++ project settings tab.
The following is the current setup:
As can be seen from the above figure, we searched the User directory, and stm32f10x_it.h is stored in this directory, so it can be searched. However, I stored stm32_eval_sdio_sd.h in the STM32_EVAL directory, so the file could not be searched. So the solution is to add the STM32_EVAL path. When we compile again, we can see that the above prompt has been solved.
3. This leads to another question, which is still related to the project settings. Let’s continue.
Observe carefully, when compiling the file stm32f10x_it.c, it prompts UserSTM32_EVALstm32_eval.h cannot find stm3210e_eval/stm3210e_eval.h.
When compiling the main.c file, it prompts UserSTM32_EVALstm32_eval.h cannot find stm3210e_eval/stm3210e_eval.h.
The reason is that both files reference "stm32_eval_sdio_sd.h", and "stm32_eval_sdio_sd.h" references stm32_eval.h.
stm32_eval.h prompts that stm3210e_eval/stm3210e_eval.h cannot be found.
Why is this the case? We saw the following code in stm32_eval.h:
It means that relative to the file stm32_eval.h, go to the stm3210e_eval directory to find the file stm3210e_eval.h. Obviously, I don't have the path stm3210e_eval, because I put stm32103_eval.h and stm32_eval.h in the same path, both in the path STM32_EVAL. So, stm3210e_eval.h cannot be found.
Knowing the cause of the problem, you will also know how to solve it. 2 methods:
1. Create the UserSTM32_EVALstm3210e_eval path and store stm3210e_eval.h there. And add ..UserSTM32_EVALstm3210e_eval in the include path.
2. You can also modify the code to #include "stm3210e_eval.h".
I usually use the second method, which has a simpler directory structure.
Previous article:STM32 pin mode GPIOMode_TypeDef
Next article:ARM cross-compilation environment configuration
Recommended ReadingLatest update time:2024-11-16 13:31
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- #idlemarket# MM32 development board exchange open source development board
- Forum Prize: Texas Instruments TI-36X Pro Scientific Calculator Disassembly and Analysis
- Why does Kalman filter need to do the prediction step?
- Misiqi's project cooperation based on ESP32 development board IOT Bluetooth WIFI
- Is this a circuit that can prevent the MCU from hanging?
- The principle and method of generating multiple PWM waveforms using one timer
- The impact of 5G on positioning technology
- Why is the output waveform of Quartus 13.0 always at a low level?
- A comprehensive look at the entire family of MSP430 microcontrollers
- CircuitPython upgraded to 5.2.0