Compiler errors fprintf未在此范围内声明

Compiler errors fprintf未在此范围内声明,compiler-errors,codeblocks,Compiler Errors,Codeblocks,我试图在代码块12.11中运行这段代码,并不断得到这个错误:fprintf未在此范围内声明 # include <GL/glew.h> # include <GL/freeglut.h> using namespace std; //any time the window is resized, this function is called. It set up to the // "glutReshapeFunc" in Maine. void changeVi

我试图在代码块12.11中运行这段代码,并不断得到这个错误:fprintf未在此范围内声明

# include <GL/glew.h>
# include <GL/freeglut.h>


using namespace std;

//any time the window is resized, this function is called. It set up to the
// "glutReshapeFunc" in Maine.
void changeViewport(int w, int h) {
   glViewport(0, 0, w, h);
}

//Here is the function that gets called each time the window needs to be redrawn.
//It is the "paint" method for our program, and it is set up from the glutDisplayFunc in         main.
void render() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSwapBuffers();
}

int main (int argc, char** argv) {
//Initialize GLUT
glutInit(&argc, argv);

//Set up some memory buffers for our display
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
//set the window size
glutInitWindowSize(900, 600);
//Create the window with the title "Hello, GL"
glutCreateWindow("Hello, GL");
//Bind the two functions (above) to respond when necessary
glutReshapeFunc(changeViewport);
glutDisplayFunc(render);

//Very important! This initializes the entry points in the OpenGL driver so we can
//call functions in the API.
GLenum err = glewInit();
if (GLEW_OK != err) {
    fprintf(stderr, "GLEW error");
    return 1;
}

//Start up a loop that runs in the background (you never see it).
glutMainLoop();
return 0;
}
#包括
#包括
使用名称空间std;
//只要调整窗口的大小,就会调用此函数。它设置为
//缅因州的“暴食者”。
无效更改视口(int w,int h){
glViewport(0,0,w,h);
}
//下面是每次需要重新绘制窗口时调用的函数。
//这是我们程序的“绘制”方法,主要是从glutDisplayFunc设置的。
void render(){
glClear(GL_颜色_缓冲_位| GL_深度_缓冲_位);
glutSwapBuffers();
}
int main(int argc,字符**argv){
//初始化过剩
glutInit(&argc,argv);
//为我们的显示器设置一些内存缓冲区
glutInitDisplayMode(GLUT_双精度| GLUT_RGBA | GLUT_深度);
//设置窗口大小
glutInitWindowSize(900600);
//创建标题为“Hello,GL”的窗口
glutCreateWindow(“你好,德国劳埃德船级社”);
//绑定两个函数(以上)以在必要时作出响应
GLUTEFUNC(更改视口);
glutDisplayFunc(渲染);
//非常重要!这将初始化OpenGL驱动程序中的入口点,以便
//调用API中的函数。
GLenum err=glewInit();
如果(GLEW_OK!=错误){
fprintf(标准“GLEW错误”);
返回1;
}
//启动一个在后台运行的循环(你永远看不到它)。
glutMainLoop();
返回0;
}
我不知道该怎么办。如果有人有任何想法,请让我知道。

#include <stdio.h>
#包括
在文件的顶部。这就是printf及其变体的生存之地。

#include <stdio.h>
#包括
在文件的顶部。这就是printf及其变体的所在地