Please Help With proto.h

Hi all,

One of my functions takes a pointer to a PtTimer_t widget as a parameter.
However, when I compile, there is a parse error in this function’s prototype
(in proto.h called from abmain.c). It seem the error is because the
PtTimer_t type is undefined when the compiler reaches this line.

I can avoid the problem by #including PtTimer.h at the start of proto.h, but
I have to keep adding this #include after every Generate. Obviously,
PtTimer.h is already #included in the source file that uses the timer.

Can anyone tell me how to ensure the compiler knows the necessary types
before it reaches them in proto.h?

Many thanks,

Neil

Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom

http://psy.swansea.ac.uk/staff/Carter/

Neil Carter wrote:

Hi all,

One of my functions takes a pointer to a PtTimer_t widget as a parameter.
However, when I compile, there is a parse error in this function’s prototype
(in proto.h called from abmain.c). It seem the error is because the
PtTimer_t type is undefined when the compiler reaches this line.

I can avoid the problem by #including PtTimer.h at the start of proto.h, but
I have to keep adding this #include after every Generate. Obviously,
PtTimer.h is already #included in the source file that uses the timer.

Can anyone tell me how to ensure the compiler knows the necessary types
before it reaches them in proto.h?

Many thanks,

Neil

Neil Carter Psychology Department
IT Technician University of Wales Swansea
Wales, United Kingdom

http://psy.swansea.ac.uk/staff/Carter/



Hi

How about simply unclick the box ‘Scan sourcecode for prototypes’ (in
Startup info/Modules dialog) and then declare your own non-cb functions
manually?

/Johan

phearbear <phearbear@home.se> wrote:

Neil Carter wrote:
One of my functions takes a pointer to a PtTimer_t widget as a parameter.
However, when I compile, there is a parse error in this function’s prototype
(in proto.h called from abmain.c). It seem the error is because the
PtTimer_t type is undefined when the compiler reaches this line.

I can avoid the problem by #including PtTimer.h at the start of proto.h, but
I have to keep adding this #include after every Generate. Obviously,
PtTimer.h is already #included in the source file that uses the timer.

How about simply unclick the box ‘Scan sourcecode for prototypes’ (in
Startup info/Modules dialog) and then declare your own non-cb functions
manually?

That’s one way. (And that’s what I usually do, too.)

Another way is to define a “global header” in PhAB and include all the
necessary headers from there. Note that when you do that, PhAB won’t
add the #include line to your existing source files – you’ll have to do
it yourself.

But what puzzles me is that I didn’t find anything called “PtTimer_t” in
PtTimer.h or any other Photon header on my machine. What puzzles me
even more is that PtTimer.h is normally included by <Pt.h>, and abmain.c
normally includes <Pt.h>, and therefore including it again in proto.h
should not change anything. Is there a detail missing from the
description of the problem here?..


\

Wojtek Lerch QNX Software Systems Ltd.