ofxFrenster error?

Hey Everyone,

I’m working on getting a second window running using ofxFrentster. The example file runs fine. But when I try to move the code verbatim from the example file into a different simple example At the end of compiling I come across some errors that I am unsure how to fix.

Here is a screenshot of the errors I am getting.

Here is the main.cpp file

  
#include "ofMain.h"  
#include "testApp.h"  
#include "ofxFensterManager.h"  
#include "ofAppGlutWindow.h"  
  
//========================================================================  
int main( ){  
	ofSetupOpenGL(ofxFensterManager::get(), 640, 480, OF_WINDOW);			// <-------- setup the GL context  
      
	// this kicks off the running of my app  
	// can be OF_WINDOW or OF_FULLSCREEN  
	// pass in width and height too:  
	ofRunFensterApp(new testApp());  
}  
  
  

here is the testApp.h file

  
#ifndef _TEST_APP  
#define _TEST_APP  
  
  
#include "ofMain.h"  
#include "ofxFensterManager.h"  
  
class boxWindow: public ofxFensterListener {  
public:  
	boxWindow() {  
		rotX = ofRandom(-20, 20);  
		rotY = ofRandom(-10, 10);  
	}  
      
	void draw() {  
		ofNoFill();  
		ofTranslate(ofGetWidth()*.5, ofGetHeight()*.5, 0);  
		ofRotateX(rotX);  
		ofRotateY(rotY);  
		ofBox(0, 0, 0, 100);  
	}  
      
	void mouseMoved(int x, int y) {  
		rotY = ofMap(x, 0, ofGetWidth(), -20, 20);  
		rotX = ofMap(y, 0, ofGetHeight(), 60, -60);  
	}  
      
	void dragEvent(ofDragInfo dragInfo) {  
		cout << "GOT SOME FILES: "<<endl;  
		std::vector<string>::iterator it = dragInfo.files.begin();  
		while(it != dragInfo.files.end()) {  
			cout << *it << endl;  
			++it;  
		}  
	}  
      
      
	float rotX;  
	float rotY;  
};  
  
  
class testApp : public ofBaseApp{  
  
	public:  
		void setup();  
		void update();  
		void draw();  
  
		void keyPressed  (int key);  
		void keyReleased(int key);  
		void mouseMoved(int x, int y );  
		void mouseDragged(int x, int y, int button);  
		void mousePressed(int x, int y, int button);  
		void mouseReleased(int x, int y, int button);  
		void windowResized(int w, int h);  
      
    ofxFenster* test;  
  
};  
  
#endif  
  

Here is the testApp.cpp file

  
#include "testApp.h"  
  
/*  
 - Draw a ball that follows the mouse  
 - Make the ball follow only when the mouse is held down  
   
 Things in this program  
 1. mouseMoved  
 2. mouseDragged  
 3. mousePressed  
 4. mouseReleased  
 */  
  
  
bool mouseIsDown;  
bool mouseIsOver;  
int ballX=0;  
int ballY=0;  
  
//--------------------------------------------------------------  
void testApp::setup(){  
	  
  
	ofEnableSmoothing();  
      
    ofSetFrameRate(60);  
    ofSetWindowShape(640, 480);  
	ofBackground(0,0,0);  
      
	int winW=300;  
      
    ofxFenster* win=ofxFensterManager::get()->createFenster(700, 0, 300, 300, OF_WINDOW);  
    win->addListener(new boxWindow());  
    win->setBackgroundColor(ofRandom(255), ofRandom(255), ofRandom(255));  
	  
	//ofSetBackgroundAuto(false);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
  
	  
	if(mouseIsDown)  
	{  
		ofRect(10, 10, 500, 500);  
	}  
	  
	  
	if(mouseIsDown)  
	{  
		ofSetColor(0, 155, 155);  
	}  
	  
    if(mouseIsOver)  
	{  
		ofSetColor(255, 0, 0);  
	}  
	else  
	{  
		ofSetColor(0, 0, 0);  
	}  
	  
	  
	ofNoFill();  
	ofSetLineWidth(5);  
	  
	ofCircle(ballX, ballY, 20);  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
  
	if(ofDist(ballX, ballY, x, y) < 20)  
    {  
		mouseIsOver=true;  
	}  
	else  
    {  
		mouseIsOver=false;  
	}  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
	ballX = x;  
	ballY = y;  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
	mouseIsDown=true;  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(int x, int y, int button){  
	mouseIsDown=false;  
}  
  
//--------------------------------------------------------------  
void testApp::windowResized(int w, int h){  
  
}  
  
  

Any help pointing me in the right direction would be amazing.

Thanks everyone
-Brian

it looks like you are missing a library that it depends on. is your project at the same folder level as the example?

Yes, the project is at the same level. I don’t think a library is missing, there are no problems in the code, it happens in the linking phase.

Hi Brian,

I had the same exact problem today, also on Mac OS! I tried to use ofxFenster in a vanilla emptyExample project, but the error you mention persisted no matter how carefully I copied everything over.

Finally the solution for me was to rebuild my app on top of ofxFenster example project instead of porting ofxFenster over to an existing project. It was a bit more tedious but it worked!

Best,

B.

Thanks for the response!

So for the most part it seems like this is the only way to solve this issue?

Trying to get to the bottom of this myself but having no luck. Compiling the application directly within the /addons directory works, but moving it to the /apps directory doesn’t.

If you take a look at the layout of the Addons/ofxFenster folder in ofxFensterExample there is a libGhost32.a directly in the /libs directory.

I’ve added a new reference to the libGhostXX.a version that you want to target directly in the /ofxFenster/libs directory. Remove the reference to /ofxFenster/libs/Ghost/libs/ to eliminate any conflicts.

Same linkage error though.

That was one of the first things I looked at too when comparing the example files and the new one. Same problem too.

…still the same problem happens to me… :frowning: …any suggestions?

(I’ve read that underdoeg is working on integrating multiple windows into oF core… maybe that would be the solution? )

Hi all

If something works from one folder but doesn’t work from another then this is a problem with relative paths. Briefly oF uses relative paths eg ‘…/…/libs’ and if a project is moved to a location that has a different path depth it will fail to compile or link.

When using addons it is important also to include extra linking information. To work with ofxFenster you need to copy the example project and base off of that as the example project contains the correct linking. We are working on a project generator that will handle much of this for you, it is available to use now but it’s very early stages and can be funky to use.