extern enum in c++
问题 I have an enum I have declared in some .h file: typedef enum { NONE, ONE, TWO, THREE } MYENUM; in a seperate .cpp I cannot do this: extern enum MYENUM; //works extern MYENUM TWO; //makes sence, TWO is not an INSTANCE of MYENUM... how would one do so without including the whole header where the enum is declared? 回答1: You can't use an incomplete type. You can only pass around pointers to it. This is because until the type is completed, the compiler doesn't know how big it is. OTOH a pointer is