[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange behavior when building
Fabrício de Novaes Kucinskis wrote:
I'm starting to develop some simple applications with RTEMS to an ERC32 BSP.
The last one has some .c files and only one header, which I #included in all
source files (in a way similar to some of the RTEMS examples).
Sometimes when trying to build, I got a "multiple definition" error. This is
not related to any specific change I made - I can change, for example, the
text in a printf call and the error can happen.
When the error happens, to build my application, I have to:
1. execute a "make clean"
2. comment the "confdefs.h" include
3. execute make (different errors will happen, because there's no confdefs
4. decomment the "confdefs.h" and
5. execute make again (this time it'll work)
If I change the includes over the source files (including bsp.h, stdio.h and
stdlib.h in each one) the problem stops. But I want to understand why this
is happening, and I would like to avoid including the same set of headers in
There is a snippet of the header:
#ifndef CONFIG_H_ //guard
#include <confdefs.h> //this is the line I have to comment when the error
Defining CONFIGURE_INIT actually instantiates data tables. So it can
only happen in one C file. If you look at the tests and samples, they
are careful to define CONFIGURE_INIT in a single file (usually init.c)
and then everything is OK. Otherwise, you get multiple definitions of
I think this is what you are describing -- either no configuration table
or multiple definitions -- one per file the .h with CONFIGURE_INIT is
Any comment will be very appreciated.
Thank you in advance,
Fabrício de Novaes Kucinskis - DEA / INPE
Divisão de Eletrônica Aeroespacial
Instituto Nacional de Pesquisas Espaciais
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985