C++ 找不到timeBeginPeriod标识符错误

C++ 找不到timeBeginPeriod标识符错误,c++,windows,C++,Windows,当我编译我的项目时,我得到了这个错误 C:\src\libs\nvrtpaudio\FileRtpSource. cpp(61) : error C3861: 'timeBeginPeriod': identifier not found C:\src\libs\nvrtpaudio\FileRtpSource. cpp(71) : error C3861: 'timeEndPeriod': identifier not found gmake[5]: *** [_out/win7_x86_de

当我编译我的项目时,我得到了这个错误

C:\src\libs\nvrtpaudio\FileRtpSource.
cpp(61) : error C3861: 'timeBeginPeriod': identifier not found
C:\src\libs\nvrtpaudio\FileRtpSource.
cpp(71) : error C3861: 'timeEndPeriod': identifier not found
gmake[5]: *** [_out/win7_x86_debug/FileRtpSource.obj] Error 2
我包括了windows.h,但此错误仍然存在。有人知道如何解决这个问题吗?

MSDN:

标题:Mmsystem.h包括Windows.h

因此,我们希望您包括windows.h,但MSDN没有说明的是,这假设您没有定义WIN32_LEAN_和_MEAN,这在定义时,也可能是从模板创建的项目中的情况—exlcudes mmsystem.h

因此,您必须确保您的项目中没有WIN32_LEAN_和_MEAN,或者直接包括:

#include "stdafx.h"
#include <mmsystem.h> // <<--- Here we go

#pragma comment(lib, "winmm.lib")

int _tmain(int argc, _TCHAR* argv[])
{
    timeBeginPeriod(0);
    return 0;
}

如果您不发布产生此错误的代码,我们将无法帮助您。是的。我定义了精益和精益的意思。