Debug Mode Question

why this is givin me an error on debug mode but not on realease mode?


vector<ofPoint>p;


//--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(255);
    ofPoint a;
    a.set(0,0,0);
    p.push_back(a);
    ofPoint b = p.at(0);
    
 
}

i dont know what i touch, but this did not happen before.
What about this?
This isnt working on realease and debug:

vector<ofPolyline*>polyLines;

//--------------------------------------------------------------
void ofApp::setup(){
    ofBackground(255);
    
    ofPolyline *t;
    polyLines.push_back(t);
    
    ofPolyline *a;
    
    a = polyLines.at(0);
    
    a->addVertex(0,0);
    
 
}

this is the error:

was compiled with optimization - stepping may behave oddly; variables may not be available.

**(lldb)**

Hi,
I would say that declaring those “global” variables, just inside the cpp file but outside of any function, is kind of a bad Idea and probably that’s why it wont work.
Then for the vector<ofPolyline*>polyLines; yout are pushing empty pointers, which will not work at all, besides the fact that you also declare the vector as a “global” variable.
Simple fix, put these inside the ofApp definition, in the ofApp.h file