need central way for #include "c:\extern\files.h"

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

need central way for #include "c:\extern\files.h"

Postby Rudi » Thu Jul 10, 2014 12:57 pm

Hi Guys,

i need a help.

I do make a MPLAP Projekt transfer to FC.
In the main.c there are defines for variable, struct and others.
The main.h have declaration of prototypes .

Example - functions are in button.c the declaration of prototypes in button.h
..

if i make a Makro of the function with c icon, the compiler do not know how the prototypes are define..
so i make a first c icon with #include "c:\extern\button.h" in the Makro and then is ok.

but this makro is only one function of the button.c.
so i make a new makro for the next function and again, a c icon for the #include "c:\extern\button.h".

the next, if i need a return from this function in the c icon in a makro,
how can i point to this return?

i can make a variable in FC, and in the makro in c icon i can define this to the FC Variable..
but i only what make a Pointer to this - is this possible?

is there a way to make the #include "c:\extern\button.h" central ?

if i need a variable from main c icon,( Struct ... ) the function in makro do not know about too.
how can i tell the function ( makro ) about the variable in main as c icon?

i hope my question is clear.

Thank you!

Rudi

User avatar
LeighM
Matrix Staff
Posts: 1929
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 464 times
Been thanked: 656 times
Contact:

Re: need central way for #include "c:\extern\files.h"

Postby LeighM » Thu Jul 10, 2014 1:31 pm

Build->Project Options->General Options
click Use supplementary code
click Supplementary Code button
and add your #include "c:\extern\button.h" to the Definitions section
you can also add global variables there too
These users thanked the author LeighM for the post:
Rudi (Thu Jul 10, 2014 1:56 pm)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: need central way for #include "c:\extern\files.h"

Postby Rudi » Thu Jul 10, 2014 1:56 pm

LeighM wrote:Build->Project Options->General Options
click Use supplementary code
click Supplementary Code button
and add your #include "c:\extern\button.h" to the Definitions section
you can also add global variables there too



Hi Leigh

thank you i will try at evenning.
Leigh, a question, is this for my other question "struct" for all macros

viewtopic.php?f=7&t=15058

the same way?
Thank you!!

Best wishes
Rudi
;-)

User avatar
Benj
Matrix Staff
Posts: 14422
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4495 times
Been thanked: 4179 times
Contact:

Re: need central way for #include "c:\extern\files.h"

Postby Benj » Thu Jul 10, 2014 2:02 pm

Hi Rudi,

The top box is for includes and prototypes.

e.g.

Code: Select all

#include "c:\extern\button.h"

char addVars (char a, char b);


The bottom box is for your functions.

e.g.

Code: Select all

char addVars (char a, char b)
{
return a + b;
}
These users thanked the author Benj for the post:
Rudi (Thu Jul 10, 2014 2:04 pm)
Rating: 5.26%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: need central way for #include "c:\extern\files.h"

Postby Rudi » Thu Jul 10, 2014 2:11 pm

Best thank Benj and Leigh!!!

The weekend is saved ;-)
I must go one and make now ..
I give you an update again on Monday
I hope that I have the project transferred by then.
wish me good luck ;-) and squeezes my thumb - this will be my resume ;-)
i have learn many from you, your staff and VC's last month in FC and programming tips.

Best wishes!!!
Rudi
;-)
These users thanked the author Rudi for the post:
Benj (Thu Jul 10, 2014 3:14 pm)
Rating: 5.26%