Re: Simple question about headers and malloc!
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Thu, 27 Dec 2007 11:34:12 -0600
#include <yyy.h> //Is this okay?
#include <xxx.c>
Have you really included xxx.c in another .c file?
This certainly looks like the issue, however Robby is using an embedded
compiler that might not support linking multiple translation units (though
that would be surprising).
int main()
{
//...some code !
//Calls functions in xxx.c
}
===========xxx.h
...some declarations
==============
===========xxx.c
#include <xxx.h>
#include <yyy.c>
Have you really included yyy.c in another .c file?
...some code
//Calls functions in yyy.c
If xxx.c uses functions from yyy.c, then xxx.c should include yyy.h. Once
it does you will probably find that main.c no longer needs to.
==============
===========yyy.h
...some declarations
==============
===========yyy.c
//Should yyy.h be included here instead?
...some code
==============
I think you need to go back to an introductory text on c and study the
differences between header files and source code files, what #include
means, and what "linking" means. I'm afraid the above is hopelessly
confused. :-(
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
.
- Follow-Ups:
- Re: Simple question about headers and malloc!
- From: Robby
- Re: Simple question about headers and malloc!
- References:
- Simple question about headers and malloc!
- From: Robby
- Re: Simple question about headers and malloc!
- From: David Webber
- Simple question about headers and malloc!
- Prev by Date: Re: why visual studio does not optimize constructor in this case
- Next by Date: Re: Efficient code maintenance
- Previous by thread: Re: Simple question about headers and malloc!
- Next by thread: Re: Simple question about headers and malloc!
- Index(es):