This is how I solved a similar problem. In the default directory, in the
Makefile, I modified the target for “proto” thus:
echo “#include <file1.h>” >proto.h
echo “#include “file2.h”” >>proto.h
approto -p $(ABSRC) $(MYSRC) >>proto.h
In essence, this makes sure that proto.h has includes for file1.h, file2.h,
etc., at the beginning of the file, where these files have the definitions
necessary for the problem prototypes. Works like a charm. You can use the
classic “#ifndef” way to make sure that file1.h et al are only included
“Wojtek Lerch” <firstname.lastname@example.org> wrote in message
Lars Skade <> email@example.com> > wrote:
I get the error when compiling one of my c files.
The globals.h is definitely included even though it’s included through
another header file that has included it. Trying to explicitly include
the c file gives me several compiler error of stuff that has been
Is there a chance that you’re including proto.h before globals.h? Have
you tried to run the code through the preprocessor and see whether
ACCESS_LEVEL indeed is defined before the prototype?
Anyway, this is not really a PhAB problem. It’s about how you design
your headers and include them in the proper order.
You have a header containing prototypes for all the functions in all
your source files. For this header to compile, you need to make sure
that all the types that are used in the prototypes are defined before
you include the header. How you do that in your source files is up to
you. How you do it in PhAB’s abmain.c is simple in principle: you just
need to put all the necessary stuff in the “global header”, and abmain.c
will include it before including proto.h.
Interesting enough I have found a way to work around the problem: I
open up the proto.h and comment out the prototype for the function that
produces the errors. I then compile the project with no errors. Then
the proto.h and remove the commenting out and I’m then able to recompile
project without any errors.
By “recompile”, do you really mean recompile? >
If you just type make after a successfull build, you’re just relinking
but not recompiling. PhAB Makefiles don’t normally have a dependency on