Borland c++ 里面线程如何睡眠?
我用Borland c++ 4.5.1
想在一个函数里实现线程睡眠
用到了:
Sleep(50);
编译出错,提示:
Error APPSVR\DATAMAN\WRNMATCH.CPP 249: Call to undefined function 'Sleep' in function ....
我加上:
#include <winbase.h>
编译提示
Error C:\BC45\INCLUDE\WINBASE.H 236: , expected
Error C:\BC45\INCLUDE\WINBASE.H 237: , expected
Error C:\BC45\INCLUDE\WINBASE.H 240: , expected
Error C:\BC45\INCLUDE\WINBASE.H 241: , expected
Error C:\BC45\INCLUDE\WINBASE.H 372: Type name expected
Error C:\BC45\INCLUDE\WINBASE.H 372: Declaration missing ;
Error C:\BC45\INCLUDE\WINBASE.H 386: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 387: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 388: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 389: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 390: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 391: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 392: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 393: Bit field too large
Error C:\BC45\INCLUDE\WINBASE.H 393: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 396: Multiple declaration for 'COMSTAT'
Error C:\BC45\INCLUDE\WINBASE.H 424: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 425: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 426: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 427: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 428: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 429: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 430: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 431: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 432: Bit fields must have integral type
Error C:\BC45\INCLUDE\WINBASE.H 432: Too many error or warning messages
[解决办法]
Sleep是Windows API函数。sleep才是C函数。
[解决办法]