Sunday, October 28, 2012

Compiling VirtualJaguar: 'usleep' was not declared in this scope

I had a little trouble compiling VirtualJaguar on my Linux machine. Everytime I run make I got the following error (on different machines with different Slackware versions): 

# tar xf virtualjaguar-2.0.2.tar.bz2
# cd virtualjaguar
# make
src/gui/mainwin.cpp: In member function 'void MainWin::ResizeMainWindow()':
src/gui/mainwin.cpp:667:14: error: 'usleep' was not declared in this scope
make[1]: *** [obj/mainwin.o] Error 1
make[1]: Leaving directory `/usr/src/games/virtualjaguar'
make: *** [virtualjaguar] Error 2

A research on the internet gave me the hint that usleep seems to be for other operatinig systems. In this case I just edited the file src/gui/mainwin.cpp and commented out the line that holds usleep(2000); (around at line 667):

# vi src/gui/mainwin.cpp
                resize(0, 0);
                /* usleep(2000); */

After that change make was successfully and a binary called virtualjaguar was created.