This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error #10056 out of nowhere



Hi,

I have a problem with my project in CCS 6.0 for AM3894. After changing one line of code in main.h (and I'm pretty sure it's only thing I've changed):

typedef struct plan_struct {
	int cp_count;
	int cp_current;
	int cp_added;
	int beam_meterset;
	UInt8 dose_rate;
	int current_dose_rate;
	int min_1;
	int max_1;
	int min_2;
	int max_2;
	int RT;
} plan_struct;


plan_struct plan_description;

to

typedef struct plan_struct {
	int cp_count;
	int cp_current;
	int cp_added;
	int beam_meterset;
	int dose_rate;
	int current_dose_rate;
	int min_1;
	int max_1;
	int min_2;
	int max_2;
	int RT;
} plan_struct;


plan_struct plan_description;

I've started receiveing error 11056 (redefined) in regard to symbol plan_description in all files that use main.h.It did not happen before. And I am sure I did not define it elswhere.

main.h has #pragma once and #ifdef safeguard, and if I remove plan_struct plan_description; from file, I get error #20 (undefined) - while also getting error #10056.

Rebuilding helps me get rid of error #10056 (only error #20 remains), but adding the definition again, brings it back (i get error #10056, but no error #20, since symbol is defined).


I get a scenario where

1. I have plan_struct plan_description definition in one place in one file that is #ifdef safeguarded, i get error #10056

2. I remove definition, I get error #20 and #10056

3. I rebuild project, I get error #20

4. I add line again, I get error #10056

I think linker has gone crazy, and I have no idea what I can do with it. Sorry for the long post and thanks for all help.

  • Hi Antoni,

    Without seeing the whole header file it's difficult to say exactly, but it is generally regarded as bad practice to define variables in header files as this can cause redefinition errors if not handled very carefully. It is much better practice to define variables in a single .C file only, and then just declare them in the 'H file (i.e. with keyword 'extern')

    Why don't you give this a try to see if your problem is resolved.

    Regards, Tony.

  • I concur with Tony that you should not put variable definitions in header files; it tends to lead to confusing error messages as your project grows.  You should change it to

    extern plan_struct plan_description;

    and put the definition of plan_description in some C file.

    Additionally, check that you don't have another definition of "struct plan_struct" somewhere else in your program.