当我尝试使用 gcc 使用以下命令编译用 c 语言编写的 opengl 代码时,它运行良好:
\n\ngcc -Wall tutorial10.c -lGL -lglut -lGLU\nRun Code Online (Sandbox Code Playgroud)\n\n但是当我尝试使用 g++ 进行相同的编译时
\n\ng++ -Wall tutorial10.c -lGL -lglut -lGLU\nRun Code Online (Sandbox Code Playgroud)\n\n它开始给出很多这样的错误:
\n\ntutorial10.c: In function \xe2\x80\x98void drawRect()\xe2\x80\x99:\ntutorial10.c:28:34: error: \xe2\x80\x98glClearBufferfv\xe2\x80\x99 was not declared in this scope\ntutorial10.c:34:28: error: \xe2\x80\x98glUseProgram\xe2\x80\x99 was not declared in this scope\ntutorial10.c:36:24: error: \xe2\x80\x98glGenBuffers\xe2\x80\x99 was not declared in this scope\ntutorial10.c:37:37: error: \xe2\x80\x98glBindBuffer\xe2\x80\x99 was not declared in this scope\ntutorial10.c:47:71: error: \xe2\x80\x98glBufferData\xe2\x80\x99 was not declared in this scope\ntutorial10.c:49:52: error: \xe2\x80\x98glVertexAttribPointer\xe2\x80\x99 was not declared in this …Run Code Online (Sandbox Code Playgroud)