Error variable not declared in this scope (SOLVED)

i’m working on raspberripi with Wiringpi lib to rotate a servo motor. I receive this error:

src/testApp.cpp: In function ‘void keyPressed(int)’:
src/testApp.cpp:27:3: error: ‘position’ was not declared in this scope
make[1]: *** [obj/linux64/Release/src/testApp.o] Errore 1
make: *** [Release] Errore 2

This error shouldn’t happens in my opinion : i declared a variable int position in testApp.h and assigned a value in testApp.cpp under setup(), in the keypressed() decementing or incrementing it:

    #pragma once
    #include "ofMain.h"
    #include "wiringPi.h"
    #include "softPwm.h"
    //#include "pthread.h"
        class testApp : public ofBaseApp{
        		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);
        		//void dragEvent(ofDragInfo dragInfo);
        		//void gotMessage(ofMessage msg);
        		int position;


#include "testApp.h"

void testApp::setup(){
if(wiringPiSetup() == -1){
	printf("Error on wiringPi setup\n");}
	pinMode (0, OUTPUT) ;
    	digitalWrite (0, LOW) ;
	position = 187;	

void testApp::update(){

void testApp::draw(){
ofDrawBitmapString("position:", position,0,20);

void keyPressed(int key){

switch (key){
	case 'a':
		position --;
    		if(position < 180) position = 180;
    		softPwmWrite(0, position);
	case 'd':
		position ++;
    		if(position > 194) position = 194;
		softPwmWrite(0, position);


shouldn’t that be:

void testApp::keyPressed(int key){

omg! why i can’t see it? i was thinking the most absurd things… it’s obvious… maybe it’s too late, better going to sleep. thank’s @zach for the help!

no problem, I make this particular mistake quite often!

yeah, happens when copy and paste functions from headers to source and forget to change…!