No "keyReleased(int)" member function in class "ofApp"

Hi all,
I get this error in both OF v0.8.0
and in a recent nightly build.
I have used testApp::keyReleased(int) before without any problem.

also ofApp::keyPressed(int) works fine.
only ofApp::keyReleased(int) causes the build to fail.

what could be the problem?

Did you delete it from the header? ( I do this all the time)

I don’t even think I have opened up the header ! :smile:
also, deleting it accidentaly from BOTH v0.8 and the nightly build sounds too much of a chance, unless they look into the same location.

where is that header located?

I think he meant your ofApp.h project file, like: ./openFrameworks/apps/myapps/yourprojectname/ofApp.h.

If you deleted it there AND you didn’t regenerate your project in both the 0.8 and nightly builds, then that seems likely that it was the cause of your build error.

But if that doesn’t fix it, what’s the specific error you get?

when you say “regenerate” how do you mean I should do it? completely create a new project from scratch? or just clean and rebuild ?

The error that I get is the following
"src/ofApp.cpp|424|error: no ‘void ofApp::keyReleased(int)’ member function declared in class ‘ofApp’ "

and my code is :

void ofApp::keyReleased(int key){
if ( !kin.keysDelegationReleased(key) ){
//if key was not intercepted by kinect class…

Why should it matter if I deleted it earlier or not?
The fact is that this is not my code and , indeed, the “keyReleased(key)” function was not present. So I typed it in. Shouldn’t this be sufficient?
if not, what should I do?

Thank you for your help!

Yes - check the header file. You need to declare the method both in the header (.h) and the .cpp file (looks like you have done this already)

Since this is not your code it sounds like the original author deleted the method from ofApp.h and ofApp.cpp.

1 Like

Sorry - didn’t realize this wasn’t your code. By regenerate, I meant create it from scratch using project generator (which would have generated the appropriate functions in both ofApp.h and ofApp.cpp).

But yeah, just do what @jvcleave said - add a keyReleased function declaration to ofApp.h.