windows 未解析的外部符号 _sleep 使用 sleep()?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5574490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unresolved external symbol _sleep Using sleep()?
提问by cellpho
I am trying to use the sleep() command. I am using C on windows (visual studio compiler). The command is simply sleep(5);
I have windows.h included, time.h, stdio.h. What more do I need?
我正在尝试使用 sleep() 命令。我在 Windows(visual studio 编译器)上使用 C。命令只是sleep(5);
我包含 windows.h、time.h、stdio.h。我还需要什么?
回答by Chris Schmich
回答by Azeemali Hashmani
The proper syntax to use sleep in Visual Studio compiler is given in windows library
在 Windows 库中给出了在 Visual Studio 编译器中使用 sleep 的正确语法
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx
So for 5 seconds of sleep use
所以对于 5 秒的睡眠使用
Sleep(5000);
You will also have to add the header file
您还必须添加头文件
Windows.h