libtcod root is messing up

586 Views Asked by At

Everytime I run this the window closes immediatly, and returns 3

#include "libtcod.hpp"

int main() {
    TCODConsole::initRoot(80,50, "j", false);
    while ( !TCODConsole::isWindowClosed() ) {
        TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS,NULL,NULL);
        TCODConsole::root->clear();
        TCODConsole::root->putChar(40,25,'@');
        TCODConsole::flush();
    }
    return 0;
}
1

There are 1 best solutions below

0
On

I can't see anything wrong with the code itself. You'll want to check that your linker is set up properly.

Additionally, see here:

http://codeumbra.eu/complete-roguelike-tutorial-using-c-and-libtcod-part-1-setting-up

For an explanation and brief tutorial.