STM32 about various header files No such file&nb

Publisher:EnchantedWishLatest update time:2017-11-22 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:STM32 Reference address:STM32 about various header files No such file&nb

Previous article:STM32 pin mode GPIOMode_TypeDef
Next article:ARM cross-compilation environment configuration

Recommended ReadingLatest update time:2024-11-16 13:31

[STM32 Motor FOC] Record 15 - TIM input capture
Input capture principle and configuration steps   1. Input Capture Concept   STM32 input capture, in simple terms, detects the edge signal on TIMx_CHx (channel X of timer X), and when the edge signal changes (such as rising edge/falling edge), stores the current timer value (TIMx_CNT) in the capture/compare register (
[Microcontroller]
[STM32 Motor FOC] Record 15 - TIM input capture
STM32 HAL library timed interrupts and encoding input
It takes a lot of time to watch videos on these basic things, and those who have some basic knowledge may not be very clear about the library when learning. I hope that the usage of the library I summarized can save everyone's time. void TIM3_Init(u16 arr,u16 psc) {       TIM3_Handler.Instance=TIM3; //General timer
[Microcontroller]
Detailed explanation of STM32 interrupt vector table offset 0x200
ST's library function for relocating the vector table: void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset) {      assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));   assert_param(IS_NVIC_OFFSET(Offset));         SCB- VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80); } Among them, NVIC_VectTab is
[Microcontroller]
STM32 independent watchdog and window watchdog timer
The STM32F10 series chip has two built-in watchdogs, which provide higher security and other benefits. The independent watchdog (IWDG) is driven by a dedicated 40KHz low-speed clock and remains effective even if the main clock fails. The main features of the IWDG are a free-running down counter, the clock of which is
[Microcontroller]
Understanding of STM32 serial port
      In general, the serial port of STM32 microcontroller is easy to understand and programming is not complicated. Of course, I would rather hope that its interrupt system is as simple as that of 51 microcontroller.       For the receiving terminal, it is RXNE, which is generated only after the reception
[Microcontroller]
STM32's built-in SPI implements reading and writing of external FLASH (W25Q128)
Experimental function: Use the KEY1 button to control the writing of W25Q128, and use another button KEY0 to control the reading of W25Q128. Hardware circuit: Software Configuration: //The following is the initialization code of the SPI module, configured as host mode   //SPI port initialization //This is the in
[Microcontroller]
STM32 timer realizes infrared remote control data reception
1. Principle 1. Infrared emission protocol There are many infrared communication protocols. This experiment uses the NEC protocol. This protocol uses PWM modulation and uses pulse width to represent 0 and 1. The data format of NEC remote control command is: synchronization terminal, address code, address inverse co
[Microcontroller]
Research on fall protection device based on STM32
    With the rapid increase of the elderly population, the aging problem has become the most prominent problem in today's society. It is known that the number of elderly people over 60 years old worldwide has exceeded 600 million. Falling is a very serious problem for the elderly. In addition to physical injuries, fal
[Microcontroller]
Research on fall protection device based on STM32
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号