2011-09-30 97 views
2

未声明时,我尝试绘图一些字符串用下面的代码:glutBitmapString()在此范围内

// label min and max for current vector 
    glRasterPos2f(nx+1,y1); 
    glutBitmapString(GLUT_BITMAP_8_BY_13,"min"); 

    glRasterPos2f(nx+1,y2); 
    glutBitmapString(GLUT_BITMAP_8_BY_13,"max"); 

我在编译时得到错误

error: ‘glutBitmapString’ was not declared in this scope 

。最不可思议的是,

// label min and max for current vector 
    glRasterPos2f(nx+1,y1); 
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13,'1'); 

    glRasterPos2f(nx+1,y2); 
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13,'2'); 

编译就好了,所以它不是像我有不包括glut库或任何东西(我有glutSwapBuffers()和bajillion其他过剩通话以及!)

为什么地球上不会glutBitmapString()编译?我检查了拼写和一切,它只是不会编译!

+0

功能的代码编译,如果你写的'glutBitmapString(GLUT_BITMAP_8_BY_13,(const的无符号字符*)“min”);'?你的'char'类型可能是默认签名的。 –

+0

nope。同样的问题! – drjrm3

回答

3

只需添加一行:

#include < GL/freeglut.h> 

此功能是通过freeglut增加了一个新的函数,而不是在过剩退出