I’m instantiating objects from myClass.
The myClass.h is included in my testApp.h, as usual.
I want to call a method of testApp from inside myClass.cpp
What is the usual/best way ?
I tried to pass a pointer to testApp (using this as an argument) while instantiating myClass objects but I had to include testApp.h inside myClass.h which had no sense at all (already included in ofMain + gave problems with myClass itself)
Any help around here?
I think a forward declaration of testApp in myClass.h should solve your problem: http://www.learncpp.com/cpp-tutorial/17-forward-declarations/
alternatively, you could try adding #pragma once (http://en.wikipedia.org/wiki/Pragma-once) to testApp.h if you include it in myClass.h.
thanks a lot for your information.
but it still doesn’t work.
about forward declaration, I don’t know which stuff to declare before…
indeed, XCode is saying that a Vector of myClass objects contains something undefined. This statement is in testApp.h itself and “something” is the myClass name itself
as I said, “forward declaration of testApp in myClass.h”
see the first part of this answer http://stackoverflow.com/a/13268263/599884
basically, in your myClass.h, before your declare myClass (which contains pointers to testApp), put
also, see http://stackoverflow.com/a/553869/599884