编译时出现C3861错误

Error C3861 during compile

本文关键字:C3861 错误 编译      更新时间:2023-10-16

你好,我试着在VS2012 (Ultimate)中运行一些OpenGL (freeglut)示例一切都工作得很好,我的绘制例程绘制了我所期望的,问题是当我试图在我的DrawScene()中添加DisplayFPS()时,我得到"错误C3861: 'DisplayFPS':未找到标识符"问题不是在功能本身,因为当我从另一个地方调用它时一切都好。如何解决这个错误?谢谢!


GLvoid DrawScene( GLvoid )
{
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();
    // draw some geometry here
    glFlush();
    glutSwapBuffers();
    DisplayFPS();
}
void DisplayFPS( void )
{
    // some code here
}

如何将DisplayFPS声明在DrawScene之上:

void DisplayFPS( void );  // <- THIS

GLvoid DrawScene( GLvoid )
{
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();
    // draw some geometry here
    glFlush();
    glutSwapBuffers();
    DisplayFPS();
}
void DisplayFPS( void )
{
    // some code here
}