0
\$\begingroup\$

I have struggled with this problem for hours now. I have created a new group in the project structure called inc. I have some existing header files that initialize the hardware in a separate folder on disk. I have tried to add these files in the newly created group, but every time I include one of the header files in my main program, the compiler complains that the file can not be found.

I have posted a screenshot of my project structure below.

project structure

Below is the error

error

\$\endgroup\$
0
\$\begingroup\$

I use uVision 5 but I suspect the answer applies to uVision 4 as well. I typically do not add the header files to the project although I suppose you could and it wouldn't matter. The thing you have to do is to add the path to the header files to the project's "Include Paths" option.

  1. In the Project menu, click "Options for (Blinky) Target..."
  2. In the Options for Target dialog, select the "C/C++" tab.
  3. In the "Include Paths" edit box, add the path where the header files are located. Separate multiple paths with a semicolon.

For example, if your header files are located in a subfolder named inc relative to location of the uVision project file then add ".\inc" to the Include Paths option.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.