This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to add header file to Keil uVision4 project?

I get the following error when I try to build my project using Keil uVision4.

Configuration\RTX_Config.c(15): error: #5: cannot open source input file "tasks.h": No such file or directory

In my project I have group named "Configuration". In this group, there are some 'c++' files.
I think in order to fix this compile error, I need to add "tasks.h" header file to
RTX_Config.c. I added it to "Configuration" group but was unable to drag and drop ito to
RTX_Config.c.

How do I drag and drop this header file to "RTX_config.c" in the Keil project?

  • I think in order to fix this compile error, I need to add "tasks.h" header file to
    RTX_Config.c.

    That thought is incorrect. What you need to do is allow the compiler to find that file. Read up about include path specifications in your compiler manual.

    Once the compiler has found that include file, uVision will display it by itself.

  • Near the top of RTX_Config.c, add a line like this:

    #include "tasks.h"
    


    if you want the compiler to search the local directory (where you store your project on the computer) for that file first before looking elsewhere (such as your include paths).

    Or add a line like this:

    #include <tasks.h>
    


    if you want the compiler to search your include path lists for the file.

    Change your include paths in the Options for Target screen, C/C++ tab, third from the bottom.