我对C++比较陌生,所以我没有丰富的经验.我学习了Python,我正在尝试使用C++编写的Python代码的改进版本.但是,我希望它能够实时工作,所以我需要设置While循环的速度.我确信有答案,但我找不到.我想要一个类似的代码:
rate(timeModifier * (1/dt))
Run Code Online (Sandbox Code Playgroud)
这是我在Python中使用的代码.我可以设置变量dt以使计算更精确,timeModifier可以设置速度的两倍或三倍(1将其设置为实时).这意味着程序将以每秒1次/秒的速度循环.我知道我可以在标题中包含time.h,但我想我对C++太新了解了解如何将其转换为我的需求.
每次我尝试编译代码时,都会遇到大量错误。这不是我的代码的问题,因为它在另一台计算机上运行得很好。我尝试重新安装和修复,但这没有帮助。这是完整的错误消息:
1>------ Build started: Project: Raptor Triangle 2, Configuration: Debug Win32 ------
1> Raptor Triangle 2.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57): error C2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57) : see declaration of 'vc_attributes::YesNoMaybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67): error C2011: 'vc_attributes::AccessType' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67) : see declaration of 'vc_attributes::AccessType'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81): error C2011: 'vc_attributes::Pre' : 'struct' type redefinition
1> c:\program files\microsoft …Run Code Online (Sandbox Code Playgroud)