I was having some weird trouble compiling a program using libtcod via console earlier (from a libtcod C++ roguelike tutorial) and I still can't get that code to work, however, after poking through some other tutorials and the like, I've been able to get another simple program to run both via console and codeblocks. I'm trying to figure out what my problem is with the original code.
This is what it looks like:
#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;
}
As per the tutorial, I'm compiling it with this input:
g++ src/*.cpp -o tuto -Iinclude -Llib -ltcod-mingw -static-libgcc -static-libstdc++ -Wall [Someone mind explaining what these commands actually do?]
I've set up the folders include and lib within the program's directory, containing the things they should contain. The code itself is stored as main.cpp within the src folder. Following some advice from the tutorial, I ran the code with a command line debugger (gdp, I think), which gives this output:
(gdb) r
Starting program: C:\Users\Soulusk\gameplace\tuto.exe
[New Thread 8900.0x14c8]
[New Thread 8900.0x888]
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.
It seems, to my untrained eyes, that it can't find the file console.cpp, which is in libtcod's src folder (I checked). Anyone here actually know what my problem is and perhaps how I might go about solving it?