lupo
stranger
Reged: Aug 02 2009
Posts: 24
|
|
Hi all, I used mplab and picc18 for a long time and everything worked perfect. Now I tried hitiede but I face a problem qhen using eht directive #include.
Let s say in my workspace in my project directory I created a new file Code:
main.c
and later I created a function in another file (in the same folde projects) ..let s say Code:
func.c
Putting the diective
Code:
#include "func.c"
I get an error when recalling the function (for istance init(): defined in the second file) it says that the function has been redefined.
In MPLAB I never faced this problem. How can I include my function defined in different files in my project directory? Both file area created with hitide!!
Thanks
Cheers
Edited by lupo (Sun Feb 07 2010 04:54 AM)
|
Dan Henry
Guru
  
Reged: Oct 16 2003
Posts: 3863
Loc: Colorado
|
|
#include'ing C source files is not conventional practice.
See http://c-faq.com/decl/decldef.html and links therein.
|
lupo
stranger
Reged: Aug 02 2009
Posts: 24
|
|
Thank you for your help I m going to bookmark that link in my browser!
Again thanks
Cheers!
|
lupo
stranger
Reged: Aug 02 2009
Posts: 24
|
|
Hi Henry, how do you define a strcture? in a separate file.h? (in case the structure is really big an dcannot be accomodated into the main file oder in other any file and considered that must be declared in the global scope)
do you declare the structure in a file..let's say struct.h, and then #include "struct.h" in your functionfile?
I couldn't find any answer in the link you posted to me.
Thanks in advance
Cheers!!
|