Home > Back-end >  Sourceinsight two file defines the structure of the same name in a variable
Sourceinsight two file defines the structure of the same name in a variable

Time:11-28

In this case, the two structure variables must be different,
This time, sourceinsight don't know to choose which defines the
So, the inside of the reference variable, is black, unable to lenovo's
I can specify which structure definition is lenovo?
bosses

CodePudding user response:

There is a concept called namespace namespace that in order to solve this problem,
So you can put two structures in two different namespace, references and namespaces to distinguish can
For example,
The namespace A {
Typedef struct {x
int a;
} X;
}

The namespace {B
Typedef struct {x
int a;
Int b;
} X;
}

Reference
A: : X A;//A reference structure of X
B: : X B;//refer to the structure of B X

CodePudding user response:

Can consider to change a head file, if the two structures with the same elements are exactly the same, can use a statement, if the members of the structure is different, suggest to change one of the structure
  • Related