This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: redefinition of `struct mallinfo' when building application



>
> Ivan Jakab wrote:
> >
> > >
> > > Ivan Jakab wrote:
> > > > > >
> > > > > > It seems that, in every file where <stdlib.h> is included, I'm
> > > > > getting the
> > > > > > "redefinition of `struct mallinfo'" error message. Does
> > > anybody have
> > > > [snip]
> > > > Now I see that I didn't mention that this message appears
> > > during application
> > > > building. It seems that it comes up in every file where I have
> > > to include
> > > > <stdlib.h>. Any ideas?
> > > >
> > > > eCos builds fine though. No such messages while building eCos.
> > >
> > > Still, it should see where the redefinition occurred, and where the
> > > original definition was. What does it say?
> > >
> >
> > While building my application, on the first file which includes
> stdlib.h,
> > the compiler drops:
> >
> > In file included from ../../../../work/src/utils/memwatch.h:329,
> >                  from ../../../../work/src/multiplatform/work.h:42,
> >                  from mips_exc.c:20:
> > /ecos/test/test_install/include/stdlib.h:206: redefinition of `struct
> > mallinfo'
> > make[1]: *** [release/mips_exc.o] Error 1
>
> Oh, I was rather expecting it to see where the original definition was. In
> that case the way to find it is to compile this file with --save-temps.
> Then in the current directory you'll find a mips_exc.ii file which is the
> file after preprocessing. Search through that for mallinfo and you'll
> hopefully find where the other definition is coming from (probably some
> headers you've imported, e.g. perhaps that memwatch.h?).
>

Thanx, Jonathan, for your help... I seem to be getting somewhere now:

After looking into mips_exec.i, I got a view on the possible reason for the
"struct mallinfo redefinition" message. It seems that I had a few "#include
"malloc.h" statements throughout my application code. Since I didn't have a
malloc.h file in may eCos build (which I don't understand why), the compiler
(gcc) included it from its own include directory. This malloc.h was the
place of the first definition of "struct mallinfo". After I removed all
includes for <malloc.h> from my code, the compilation passed fine.

How come I have no malloc.h in my eCos build? Did I miss something in the
configuration file? How come "struct mallinfo" is defined in stdlib.h? Sorry
for all this questions... They're just jumping from the top of my mind...
;-)


Regards,

Ivan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]