Re: problem with multiple source file



On Apr 8, 7:05 pm, Ben Bacarisse <ben.use...@xxxxxxxxx> wrote:
pereges <Brol...@xxxxxxxxx> writes:
I hae compiled and executed codes of vector.c, reader.c , test.c
seperately and they can be execute in proper manner and give correct
outputs but when i tried to integrate them all into a single project
using pelles C it is giving two many errors.

You could help people out with an error message!

You have got tied up in includes, trying to get common.h to do
everything. It can be done like that, but if when, say, test. include
common.h which needs reader.h which tries to get what it wants from
common.h (you just have to go thought this carefully by hand or using
something like gcc -E to see that it does not work).

Get rid of common.h and have every file include what it needs. You
can have one .h file that includes another if you like that style but
circular includes will tie you in knot.

I could post error messages but theres just way too many. I think
change my approach. In my project, vector data structure and
operations are meant to be seen by every module so I will put that it
into common.h along with some common header files like stdio, stdlib ,
string and math which are needed almost every module. Suppose

all.h

a.h a.c
b.h b.h
c.h c.c

Now each of the .h's file should include all.h and every .c file will
include its corresponding .h file. I think then in main.c you need to
include all the headers including all.h


.



Relevant Pages

  • Re: problem with multiple source file
    ... You could help people out with an error message! ... into common.h along with some common header files like stdio, stdlib, ... program is not at that sort of size yet. ... not try the plain method first. ...
    (comp.lang.c)
  • Re: problem with multiple source file
    ... seperately and they can be execute in proper manner and give correct ... outputs but when i tried to integrate them all into a single project ... You could help people out with an error message! ...
    (comp.lang.c)