visual studio error: syntaxfehler bezeichner
-
Hi,
ich hab folgende 2 klassen:
IHyCnc.h
#pragma once #include "Control.h" class IHyCnc { private: public: int Do(); };IHyCnc.cpp
#include "IHyCnc.h" int IHyCnc::Do() { return true; }Control.h
#pragma once #include "IHyCnc.h" class Control { public: IHyCnc *test; void UpDatePositionData(); };Control.cpp
#include "control.h" void Control::UpDatePositionData() { }Wenn ich das ganze kompiliere bekomme ich folgende fehler:
Syntaxfehler: Es fehlt ';' vor '*'
Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt
wenn ich den klassenmember IHyCnc *test; weglasse funktionierts. Kann mir vl jemand sagen was ich falsch mache?
thx
-
Nennt sich "zyklisches inkludieren" oder so und ist ein Standardproblem von C und C++.
IHyCnc.h
#pragma once //#include "Control.h"//NICHT NÖTIG! class IHyCnc { private: public: int Do(); };Control.h
#pragma once #include "IHyCnc.h"//OK, beinahe nötig wegen... class Control { public: IHyCnc *test;//...wegen hier void UpDatePositionData(); };
-
Als weiteres Stichwort: Vorwärtsdeklaration (forward declaration)
-
ok danke problem gelöst

lg