sergey.pozhidaev Posted February 7, 2014 Posted February 7, 2014 Is it ok what this code is not work? class Gr { }; class Foo { void a(Bar bar) { Gr gr = bar.getGr(); } }; class Bar:Unigine::Widgets::Window { Gr getGr() { } }; But this code is work class Gr { }; class Foo { void a(Bar bar) { Gr gr = bar.getGr(); } }; class Bar { Gr getGr() { } };
azagniy Posted February 7, 2014 Posted February 7, 2014 Hi, this is a simple mistake :) The "Foo" class don't knows about "Bar" class You need declare class "Foo" below a class "Bar", like this: class Gr { }; // class Bar declaration class Bar:Unigine::Widgets::Window { Gr getGr() { } }; // class Foo declaration class Foo { void a(Bar bar) { Gr gr = bar.getGr(); } }; and all to be alright
sergey.pozhidaev Posted February 8, 2014 Author Posted February 8, 2014 Bar need to have pointer to Foo & Foo need to have pointer to Bar. Bar is main class and Foo is utility class. all includes done in Bar class file, so it is not so good to include it after Bar class definition. So we put all our code into Unigine::Widgets namespace & all becomes fine. But anyway, all of this solutions are hacks to prevent this compiler bug.
Recommended Posts