c++.dos - Help me!
- ZaitcevE.V. (25/25) Jan 09 2002 Why that following fragment of the program gives mistake of compilation ...
- Walter (7/32) Jan 10 2002 kmen is nested inside defmen. You defined a new defmen class at global s...
Why that following fragment of the program gives mistake of compilation for .cpp: struct defmen { struct kmen { struct defmen *men; short int *mkeyout; } *mnext; char *mstr; }; void main(int argc, char **argv) { struct kmen *text; text->men[0].mstr; } L:\ZAICEV\MED\PROJ\MARS>sc test.cpp -ml text->men[0].mstr; ^ test.cpp(20) : Error: 'men' is not a member of undefined class 'kmen text->men[0].mstr; And for .C all is compiled normally! In VC 1.0 too all O'k. How to bypass this problem?
Jan 09 2002
kmen is nested inside defmen. You defined a new defmen class at global scope with the declaration of text. The solution is to move the definition of struct kmen into the global scope. -Walter "ZaitcevE.V." <Genior km.ru> wrote in message news:a1jima$2jjg$1 digitaldaemon.com...Why that following fragment of the program gives mistake of compilationfor.cpp: struct defmen { struct kmen { struct defmen *men; short int *mkeyout; } *mnext; char *mstr; }; void main(int argc, char **argv) { struct kmen *text; text->men[0].mstr; } L:\ZAICEV\MED\PROJ\MARS>sc test.cpp -ml text->men[0].mstr; ^ test.cpp(20) : Error: 'men' is not a member of undefined class 'kmen text->men[0].mstr; And for .C all is compiled normally! In VC 1.0 too all O'k. How tobypassthis problem?
Jan 10 2002