• AVR Freaks

Hot!Creating Header file in project

Author
john_ive
Super Member
  • Total Posts : 208
  • Reward points : 0
  • Joined: 2017/05/22 22:22:08
  • Location: 0
  • Status: offline
2019/09/15 02:05:44 (permalink)
0

Creating Header file in project

Please refer the both images,
When I create an header file in the project means,there are two options to save the header file.
1.C:\Users\PC\Desktop\Project_009\Project_009\
2.C:\Users\PC\Desktop\Project_009\Project_009\Project_09.X
in which folder,have to save the header file.
Is it make some errors,while saving header file wrongly..?
 
I'm using MPLAB X IDE 5.15 and XC8 softwares...

Attached Image(s)

#1

1 Reply Related Threads

    Mysil
    Super Member
    • Total Posts : 3353
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: Creating Header file in project 2019/09/15 03:24:17 (permalink)
    +3 (3)
    Hi,
    There is nothing wrong with storing header files in either of those directories,
    or any other directory you may choose.
    In C programming language, header files may be stored in any directory.
    However, if a header file is not stored in the obvious place,
    then You will have to tell the compiler where to search for header files.
     
    There is basically two different ways: Specifying a directory search list in MPLAB IDE,
    or specifying absolute or relative directory path in every #include line where it may be needed.
    In a large project with many files in multiple directories, this may become complicated, and may need planning and clear thinking.
     
    In a MPLAB X project, the default directory for source and header files, is the ...X directory, eg.:
        C:\Users\PC\Desktop\Project_009\Project_009\Project_09.X
    the simplest solution for a small project, is to store all source and header files in the same directory.
     
    Directories you have, may seem to come from a MPLAB 8 project that have been converted to MPLAB X,
    thus the two directories with some files each.
     
    Note: Copying a header file, such that the same file is available in different directories,
    may solve a immediate problem, but when one file is edited and the other is not, then this will cause even more confusing problems later.
     
        Mysil
     
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5