Passing window to other apps

I’m trying to do this based on examples provided in other threads (where users also had issues with this) and I cannot get it to work:

int main( ){

ofGLFWWindowSettings settings;
settings.setSize(1024, 768);
settings.resizable = true;
shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

settings.setSize(300, 768);
settings.resizable = true;
shared_ptr<ofAppBaseWindow> settingsWindow = ofCreateWindow(settings);

shared_ptr<ofApp> mainApp(new ofApp);
shared_ptr<settingsApp> guiApp(new settingsApp);
shared_ptr<params> sharedState(new params);

mainApp->params = sharedState;
guiApp->params = sharedState;

guiApp->window = settingsWindow;// this should work but throws an error?

ofRunApp(mainWindow, mainApp); // this order is important for the shared parameters...
ofRunApp(settingsWindow, guiApp); 


the error message is ‘non member named ‘window’’. From what I can tell this should be created by the ofCreateWindow, but it cannot find it. Has this function been deprecated, or renamed in the 0.11 version?

I am trying to access more variables than just the basic window parameters like title and shape, hence I need to pass the window entity to other apps.

do you have the following in the settingsApp class definition?

class settingsApp{
         shared_ptr<ofAppBaseWindow> window; 

Hi Theo,

thanks for that, no I didn’t have that as it wasn’t mentioned in the code examples I read. I nw added that and I’m getting a bit further. I added this into my main ofApp:


But now I get the error that settingsWindow is not declared :frowning: I’m not sure how to declare or share it (the whole ptr thing is a bit obscure to me tbh). From what I understand the added line you suggest is to make the window ‘shareable’ to other apps, and I should be able to changes e.g. shape and such. What is missing?