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 specify header files easily, like searching subdirectory

Do we have to specify the header files' path which are located in different directories one by one directory ? Can I just specify the general directory ,and letting the mdk itself searching header files in sub-directories?

There are too many sub-directories,and it's taking a lot of time. Can anyone help me please? Thx!

Parents Reply Children

  • So how, exactly, are you doing that search??

    The search facility within uVision certainly can include subfolders;

    The search facility within Windows Explorer certainly can include subfolders.

  • Andrew, my project is very large, and the design of subfolders is used to make the whole structure more clearly ,just like linux subfolders.

    The 'search' here means that, when filling the 'include path' in 'C/C++' tab of the project in uVision, I find that if I only contain main level folder, the subfolders won‘t be searched for header files needed.

    Example,
    file "basetypes.h" is located in folder B, which is a subfolder of folder A.
    file "basetypes.h" is needed by file "main.c" which is located in folder A.

    /*main.c*/
    #include"basetypes.h"
    

    If I just set the include path as './A', then the complier will pop an error as "can't open basetypes.h,the file is not found"

    I wonder if there's any settings in uVision I missed?

  • I normally use relative path in the source files if I need a number of subdirectories.

    So

    /* main.c */
    #include "com/magic_protocol_1.h"
    #include "com/magic_protocol_2.h"
    #include "i2c/eeprom.h"
    #include "spi/modem.h"
    ...
    

    The source files in their subdirectories can manage with just:

    /* i2c/eeprom.h */
    #include "eeprom.h"
    
    ...
    
    /* spi/modem.c */
    #include "modem.h"
    #include "modem_commands.h"
    #include "modem_compression.h"
    ...
    

    Then I don't need a huge number of include directories specified for the project, even if the project has many 100k of source lines spread over a large number of source files.

  • thank you,Per. It seems the best solution for the current MDK. I'll take it.