[OBSOLETE Tutorial][Advanced]2.PokittoSim - programming using a Simulator

OK, now I get

BmpImage.cpp|397|error: ‘max’ was not declared in this scope
BmpImage.cpp|398|error: ‘min’ was not declared in this scope

There is a fix for that

1 Like

Cool. Thanks…

1 Like


Get that error…

Reading the red text it’s looking for mingw compiler Wich is windows specific compiler (it’s also has a .exe externsion)
You could try going to the menubar settings as it says and change compiler to the buildin gnu gcc or llvm usually called clang
Sorry I have not tried this myself on Mac is at all so the rest of the sim might still be broken somewhere

1 Like

I got that error on my windows machine.

Edit: Got it working now. I needed to restore default settings at compiler settings. Weird since I didn’t changed them and just followed the instructions… But anyway, it works now ^^

1 Like

It works now, but which keys do I need to press on the simulator?

See first post

2 Likes

Getting some segfaults on Linux. The simulator runs like once in every 5 tries, other times I’m getting:

tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
Aborted
tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
Aborted
tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
Segmentation fault
tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
Aborted
tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
Segmentation fault
tastyfish@tastyfish-Lenovo-ideapad-700-15ISK ~/Git/PokittoSim/POKITTO_SIM/bin/Debug $ ./Pokitto_sim 
*** Error in `./Pokitto_sim': munmap_chunk(): invalid pointer: 0x0000000001c39600 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fa4725a57e5]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7fa4725b2698]
/usr/lib/nvidia-384/libGL.so.1(+0xb68a1)[0x7fa46bb648a1]
======= Memory map: ========
00400000-00422000 r-xp 00000000 08:02 33033516                           /home/tastyfish/Git/PokittoSim/POKITTO_SIM/bin/Debug/Pokitto_sim
00621000-00622000 r--p 00021000 08:02 33033516                           /home/tastyfish/Git/PokittoSim/POKITTO_SIM/bin/Debug/Pokitto_sim
00622000-00623000 rw-p 00022000 08:02 33033516                           /home/tastyfish/Git/PokittoSim/POKITTO_SIM/bin/Debug/Pokitto_sim
00623000-00660000 rw-p 00000000 00:00 0 
...

Let me see, maybe I’m doing something wrong.

EDIT:

valgrind output:

Summary
valgrind ./Pokitto_sim 
==18654== Memcheck, a memory error detector
==18654== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==18654== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==18654== Command: ./Pokitto_sim
==18654== 
==18654== Syscall param writev(vector[...]) points to uninitialised byte(s)
==18654==    at 0x59F3FBD: ??? (syscall-template.S:84)
==18654==    by 0x9221F28: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==18654==    by 0x922231C: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==18654==    by 0x92223A4: xcb_writev (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==18654==    by 0x696B4AD: _XSend (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==18654==    by 0x696B9A1: _XReply (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==18654==    by 0x695659E: XInternAtom (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==18654==    by 0x4EF9AEA: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EFA8F1: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EEC148: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EEBF34: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4E53396: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==  Address 0xbc2a893 is 35 bytes inside a block of size 16,384 alloc'd
==18654==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18654==    by 0x695B692: XOpenDisplay (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==18654==    by 0x4EF8DB4: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EEBEE0: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4E53396: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x412E11: Pokitto::Simulator::initSDLGfx() (PokittoSimulator.cpp:165)
==18654==    by 0x4140ED: Pokitto::lcdInit() (in /home/tastyfish/Git/PokittoSim/POKITTO_SIM/bin/Debug/Pokitto_sim)
==18654==    by 0x4042CA: Pokitto::Display::begin() (PokittoDisplay.cpp:209)
==18654==    by 0x402060: Pokitto::Core::begin() (PokittoCore.cpp:108)
==18654==    by 0x4038CF: main (Chipeng.cpp:23)
==18654== 
==18654== Thread 4 SDLAudioDev2:
==18654== Invalid write of size 1
==18654==    at 0x4134BF: simAudioCallback(void*, unsigned char*, int) (PokittoSimulator.cpp:496)
==18654==    by 0x4E5583A: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EB509B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4F03398: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x830B6B9: start_thread (pthread_create.c:333)
==18654==    by 0x59FE3DC: clone (clone.S:109)
==18654==  Address 0xee6f2cd is 0 bytes after a block of size 285 alloc'd
==18654==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18654==    by 0x4EEEBCE: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4E566B2: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x413542: Pokitto::Simulator::initSDLAudio() (PokittoSimulator.cpp:520)
==18654==    by 0x4137BB: Pokitto::soundInit() (SimSound.cpp:54)
==18654==    by 0x4099D4: Pokitto::Sound::begin() (PokittoSound.cpp:226)
==18654==    by 0x40206A: Pokitto::Core::begin() (PokittoCore.cpp:113)
==18654==    by 0x4038CF: main (Chipeng.cpp:23)
==18654== 
==18654== Invalid read of size 8
==18654==    at 0x8B700D5: pa_mempool_block_size_max (in /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so)
==18654==    by 0x64FCBBF: pa_stream_write_ext_free (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0)
==18654==    by 0x64FCFE0: pa_stream_write (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0)
==18654==    by 0x4EEE5F4: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4E557D5: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EB509B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4F03398: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x830B6B9: start_thread (pthread_create.c:333)
==18654==    by 0x59FE3DC: clone (clone.S:109)
==18654==  Address 0x7e7e7e7e00000030 is not stack'd, malloc'd or (recently) free'd
==18654== 
==18654== 
==18654== Process terminating with default action of signal 11 (SIGSEGV)
==18654==  General Protection Fault
==18654==    at 0x8B700D5: pa_mempool_block_size_max (in /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so)
==18654==    by 0x64FCBBF: pa_stream_write_ext_free (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0)
==18654==    by 0x64FCFE0: pa_stream_write (in /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0)
==18654==    by 0x4EEE5F4: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4E557D5: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4EB509B: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x4F03398: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.4.0)
==18654==    by 0x830B6B9: start_thread (pthread_create.c:333)
==18654==    by 0x59FE3DC: clone (clone.S:109)
==18654== 
==18654== HEAP SUMMARY:
==18654==     in use at exit: 4,561,435 bytes in 2,478 blocks
==18654==   total heap usage: 24,752 allocs, 22,274 frees, 639,064,987 bytes allocated
==18654== 
==18654== LEAK SUMMARY:
==18654==    definitely lost: 3,216 bytes in 3 blocks
==18654==    indirectly lost: 0 bytes in 0 blocks
==18654==      possibly lost: 467,424 bytes in 27 blocks
==18654==    still reachable: 4,090,795 bytes in 2,448 blocks
==18654==                       of which reachable via heuristic:
==18654==                         newarray           : 16 bytes in 1 blocks
==18654==                         multipleinheritance: 104 bytes in 1 blocks
==18654==         suppressed: 0 bytes in 0 blocks
==18654== Rerun with --leak-check=full to see details of leaked memory
==18654== 
==18654== For counts of detected and suppressed errors, rerun with: -v
==18654== Use --track-origins=yes to see where uninitialised values come from
==18654== ERROR SUMMARY: 71 errors from 3 contexts (suppressed: 0 from 0)
Killed

Actually I think I might have seen this error before, could be wrong SDL installation.

EDIT2:

well, still don’t know :confused:

fun workaround for now:

#!/bin/bash

while true
do
  SECONDS=0
  ./Pokitto_sim

  if [ $SECONDS -ge 4 ]; then
    break
  fi
done

you have exactly the same symptoms as I have noticed

1 Like