Kodi Community Forum
gcc 4.7 'sleep' was not declared in this scope - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: gcc 4.7 'sleep' was not declared in this scope (/showthread.php?tid=126588)



gcc 4.7 'sleep' was not declared in this scope - downer88 - 2012-03-26

I couldn't log into bug tracker to submit this bug. I ran across this bug with new gcc 4.7 on Fedora:
Code:
make: Entering directory `/rpmbuild/BUILD/xbmc-11.0-Eden_beta1/tools/EventClients'
cd Clients/WiiRemote && \
/usr/bin/ccache g++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m64 -mtune=generic -fPIC -I/usr/include/ffmpeg -D__STDC_CONSTANT_MACROS -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG=1 -fPIC CWIID_WiiRemote.cpp -lcwiid -lbluetooth -DICON_PATH="\"/usr/share/pixmaps/xbmc/\""  -o WiiRemote
CWIID_WiiRemote.cpp: In static member function 'static void CWiiRemote::MessageCallback(cwiid_wiimote_t*, int, cwiid_mesg*, timespec*)':
CWIID_WiiRemote.cpp:65:12: warning: enumeration value 'CWIID_MESG_BALANCE' not handled in switch [-Wswitch]
CWIID_WiiRemote.cpp:65:12: warning: enumeration value 'CWIID_MESG_MOTIONPLUS' not handled in switch [-Wswitch]
CWIID_WiiRemote.cpp: In function 'int main(int, char**)':
CWIID_WiiRemote.cpp:767:14: error: 'sleep' was not declared in this scope
make: *** [Clients/WiiRemote/WiiRemote] Error 1
make: Leaving directory `/rpmbuild/BUILD/xbmc-11.0-Eden_beta1/tools/EventClients'
error: Bad exit status from /var/tmp/rpm-tmp.x1hdIa (%install)

I'm not a programmer, but I added #include <unistd.h> to
/xbmc/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h
and it went away.
(From http://pubs.opengroup.org/onlinepubs/007908799/xsh/sleep.html )

Really nice program by the way!

I also still get this error with gcc 4.7 https://bugzilla.redhat.com/show_bug.cgi?id=805958 but it's from ffmpeg.


RE: gcc 4.7 'sleep' was not declared in this scope - spiff - 2012-03-26

your fix is correct. this tends to happen when we hop gcc versions as the include orders (in particular which header includes which) changes. in particular, gcc has moved towards being less and less forgiving, and have better split headers than it used to.