We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
My project includes 24C16.c 24C16.h CS5532.C CS5532.H and main.c. The MCU I use is SyncMos company's SM8958A. Now I write
include <sm8958a.h>
in 24C16.h and CS5532.h sperately, then I write
#include "24C16.h"
and
#include "CS5532.h"
in main.c. When I build target, like C:\KEIL\C51\INC\SYNCMOS\SM8958A.H(11): error C231: 'P0': redefinition etc. appear in Output Window. Then I change the Device, I choose SM8052 and modify
to
include <reg52.h>
,building and compiling are ok. Can you help me why the errors would appear when I use SM8958A and
?
Some include files have protection from multiple inclusion. In this case, the file "sm8958a.h" doesn't seem to have that.
However, hy do you modify 24C16.h and CS5532.h to include sm8958a.h? That is a conceptual mistake.
If you have one include file "global.h", then you may add <sm8958a.h> to that file.
If you have a file 24c16.h that is included by 25c16.c and a number of other source files (together with zero or more other include files) then you shouldn't add sm8958a.h to 24c16.h.
Instead, you should include sm8958a.h AND 24c16.h in your 24c16.c file.
And you should include sm8958a.h (before your own include files) AND 24c16.h AND CS5532.h in your main.c file.
Thank you very much. I know how to do .