C++ Code Executes Only When the Program Is Run From The Terminal
I have a strange bug that appears to happen only when the program isn't executed from the terminal. Here is my project: https://github.com/elliotpotts/Troll/ https://github.com/elliotpotts/Troll/issues/2
Look at the Troll::State::keyPressed() function. For some reason when I run the program from the terminal, everything is fine and开发者_C百科 the application exist but when I run it as a GUI program, the appliction doesn't exit. I can't think why. Thanks in advance, ell.
EDIT: Apologies for not adding Ogre tag and not posting the keyPressed function, here it is:
void Troll::State::keyPressed(const OIS::KeyEvent& event){
if(event.key == OIS::KC_Q) {
mCreator->stop();
};
};
I have also tried adding file output to test it:
void Troll::State::keyPressed(const OIS::KeyEvent& event){
std::cout << "Q was pressed" << std::endl;
std::fstream file("log");
file << "Q was pressed";
file.close();
if(event.key == OIS::KC_Q) {
mCreator->stop();
};
};
When run from the terminal, this works, otherwise, it does not. An added note, I do not have a functioning debugger at the moment which I am also trying to fix. Ell.
It turns out it was the IDE causing the problem, thanks for your help anyways, ell :)
精彩评论