I'm starting to learn C++ (I have a very basic programming background) and I have in mind to create an old-school ASCII-looking roguelike. I know it may be easier in Python, but it has to be in C++. I'm using Windows 10.
I want some eye candy beyond basic ASCII, I've seen libtcod 1.5.1 offers a lot of possibilities so I wanted to try it and follow this tutorial. The problem is I'm stuck right at the beginning, because the libtcod demo "samples_cpp.exe" works but not the example code:
#include "libtcod.hpp"
int main()
{
TCODConsole::initRoot(80, 50, "libtcod C++ tutorial", false);
while ( !TCODConsole::isWindowClosed() )
{
TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS, NULL, NULL);
TCODConsole::root->clear();
TCODConsole::root->putChar(40, 25, '@');
TCODConsole::flush();
}
return 0;
}
If I launch the .exe compiled with the command:
g++ src/*.cpp -o tuto -Iinclude -Llib -ltcod-mingw -static-libgcc -static-libstdc++ -Wall
by double-click, it opens and closes a window very fast, and if I execute it from the console I get the in-console message:
24 bits font.
key color : 0 0 0
character for ascii code 255 is colored
Any clues of what I'm doing wrong? The project has all the proper .dll and include folder. This should be pretty easy :/
Thanks a million!
UPDATE: Ok, I got some new info, gdb says this:
[New Thread 7468.0x1f24]
[New Thread 7468.0x203c]
[New Thread 7468.0x1bdc]
[New Thread 7468.0x190c]
[New Thread 7468.0x108c]
24 bits font.
key color : 0 0 0
character for ascii code 255 is colored
Using SDL renderer...
Program received signal SIGSEGV, Segmentation fault.
0x65e70d9f in TCODConsole::clear (this=0x1) at src/console.cpp:196
196 src/console.cpp: No such file or directory.
Not sure what that means, the console.cpp file of libtcode at line 196 has the following:
void TCODConsole::clear() {
TCOD_console_clear(data);
}