Home > Software engineering >  Questions about the Win32 API functions
Questions about the Win32 API functions

Time:09-24

The error C2065: 'SwitchToThread: undeclared identifier
I want to sleep but will appear the error using SwitchToThread this function can have eldest brother great spirit under the guidance of how to use this function,
https://msdn.microsoft.com/en-us/library/ms686352.aspx
This is the function of annotation

CodePudding user response:

The Header

WinBase. H on Windows XP and Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 and Windows Server 2008 R2 (include Windows. H );
Processthreadsapi. H on Windows 8 and Windows Server 2012
The three header files, there is always a can

CodePudding user response:

The several header files? The novice and there are many don't understand I can explain

CodePudding user response:

Details see the MSDN annotation
To compile an application that USES this function, define _WIN32_WINNT as 0 x0400 or later.

CodePudding user response:

Use the Sleep (0);//give up the current process remaining run time

CodePudding user response:

this is undefined error,
Need to include the header file WinBase. J h, as long as the Windows project, this header file is included by default,
Is your project when the choice, the console program, rather than a Windows program?
  • Related