[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RES: Strange behavior when building
I thought that a guard condition ("#ifndef CONFIG_H_ [...] #endif") was
enough, but I was wrong.
I changed the CONFIGURE_INIT definition as you said, and everything is ok
Thank you very much!
De: Joel Sherrill <joel@OARcorp.com> [mailto:joel.sherrill@OARcorp.com]
Enviada em: terça-feira, 20 de dezembro de 2005 13:10
Para: Fabrício de Novaes Kucinskis
Cc: RTEMS - Mailing List
Assunto: Re: Strange behavior when building
Fabrício de Novaes Kucinskis wrote:
> I'm starting to develop some simple applications with RTEMS to an ERC32
> The last one has some .c files and only one header, which I #included in
> source files (in a way similar to some of the RTEMS examples).
> Sometimes when trying to build, I got a "multiple definition" error. This
> 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
> 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
> 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
> each file.
> There is a snippet of the header:
> #ifndef CONFIG_H_ //guard
> #define CONFIG_H_
> #include <bsp.h>
> #include <stdio.h>
> #include <stdlib.h>
> rtems_task Interface[...]
> rtems_timer_service_routine Timer[...]
> boolean VerifyStatus[...]
> //RTEMS configuration
> #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_INIT
> #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
> #endif /*CONFIG_H_*/
> 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