Strange behavior when building

Fabrício de Novaes Kucinskis fabricio at dea.inpe.br
Tue Dec 20 12:59:26 UTC 2005


Hello,


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
inclusion)
	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
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>

	//Prototypes
	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

	#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




More information about the users mailing list