cancel
Showing results for 
Search instead for 
Did you mean: 

Build issue - error directive usage

demir
Senior II

Hi All,

 

I am having a strange error. When I compile my code, the error directive causes the ERROR. I can not pinpoint the issue. Could you please hint me in the right direction?

Thanks and Regards,

 

demir_0-1706300477525.png

 

2 REPLIES 2
TDK
Guru

Well, the error message says the cc950.c file is not needed in the current configuration and to remove it from the project.

I would guess that this means the file is not needed in the project and that you should delete it or otherwise exclude it from the build.

If you feel a post has answered your question, please click "Accept as Solution".
Oskar_H
Senior

Hello @demir 

this one is easy: your project links too many .c files for code pages. This is detected by checking the value of _CODE_PAGE in each of them. As this define has a specific value, probably set by a FatFS configuration header file, the only .c file which is not generating this error should be kept from link and the others have to be removed, just as the error message says it clearly.

The reasons for this are:

  • only one code page is active at a time
  • it saves space from useless data in object files
  • it avoids linker issues like duplicate symbols (uni2oem would be declared many times...)

By the way, the #error directive is very useful and is generally used to detect an issue imagined by the developer before the preprocessor/compiler/linker falls into it. Therefore it has to display a more explicit message for a human to understand.