20130221-stm32 A detailed workaround for the various header files no such file or directory

Source: Internet
Author: User

Beginners STM32 often learn to find the online routine, or buy the development of the Board and so on, often at compile time encountered

.. \USER\STM32F10X_IT.C: Error: #5: Cannot open source input file "Stm32_eval_sdio_sd.h": No such file or directory

Wait, you can't get a compile error for a header file. Most of the internet will refer to the problem of engineering settings, path settings are not correct, unable to find files and so on. Because this small problem also took some time, now the mind is still sober, recorded.

1. First, it is important to understand clearly the meaning of the project settings path, why to set this path instead of other. Set for what reason. A: The path to the project setup is to search for the *.h file.

The following figure is my project path, where the user folder is used to store the files that I need to write or modify.

Let's look at the files under the user path again. Of these, 3. c files and 2. h files are copied under the Stm32f10x_stdperiph_lib_v3.5.0\project\stm32f10x_stdperiph_examples\sdio path of the official library.

Stm32_eval is stored in a copy of 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

A total of 6 files. We don't care about this folder first.

When you compile, you are prompted

.. \USER\STM32F10X_IT.C: Error: #5: Cannot open source input file "Stm32_eval_sdio_sd.h": No such file or directory

.. \USER\MAIN.C: Error: #5: Cannot open source input file "Stm32_eval_sdio_sd.h": No such file or directory

The following figure:

Careful observation will find that it is stm32f10x_it.c and main.c hint to find stm32_eval_sdio_sd.h.

Then why are these two file hints? We observed that the stm32_eval_sdio_sd.h was quoted at the top of MAIN.C and stm32f10x_it.c, as shown in the following diagram:

Oh, it's a. c file that references the. h file, and the. h file is not found. Stm32f10x_it.c also quoted the stm32f10x_it.h. Then why not error? The reasons are shown in the following figure:

Within the user path we store stm32f10x_it.h,stm32f10x.c to find stm32f10x.h so we don't get an error.

Stm32f10x_it.c references Stm32f10x.h and stm32_eval_sdio_sd.h. Then why can find stm32f10x.h and can't find stm32_eval_sdio_sd.h?

Finally lead to the point. That's what I'm talking about. The Project Settings tab, C + +, has a problem with how the include path is set.

The following figure is the current setting:

As you can see from the image above, we searched for the user directory, and stm32f10x_it.h is stored in that directory, so we can search for it. I kept the stm32_eval_sdio_sd.h in the Stm32_eval directory, so I couldn't find the file. So the solution is to add stm32_eval this path. Once we compile, we can see that the above hints have been resolved.

3. This brings up another problem, which is still related to the engineering setup, and we continue.

Careful observation, compile stm32f10x_it.c this file when prompted \user\stm32_eval\stm32_eval.h can't find stm3210e_eval/stm3210e_eval.h.

Compiling main.c This file prompts \user\stm32_eval\stm32_eval.h to find stm3210e_eval/stm3210e_eval.h.

The reason is that all two files refer to "Stm32_eval_sdio_sd.h", while "stm32_eval_sdio_sd.h" references stm32_eval.h.

Stm32_eval.h hints that stm3210e_eval/stm3210e_eval.h could not be found.

Why is that so? We saw the following code in Stm32_eval.h:

Its meaning is relative to stm32_eval.h this file, go to stm3210e_eval directory to find stm3210e_eval.h this file. Obviously I did not stm3210e_eval this path, because I put stm32103_eval.h and stm32_eval.h in the same path, are placed in the Stm32_eval this path. Therefore, can not find the stm3210e_eval.h.

Knowing the cause of the problem, we will know how to solve it. 2 ways:

1. Create the \user\stm32_eval\stm3210e_eval path and store the stm3210e_eval.h here. and add in the Include path: \user\stm32_eval\stm3210e_eval can be.

2. Modify the code to include "Stm3210e_eval.h".

Usually I use the 2nd method, the directory structure is simple.

At this point, the question should be made clear. If there are new learning STM32 friends can see my this note, welcome reprint.

2013.02.21 in the unit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.