小编use*_*759的帖子

使用 g++ 的 OpenGL 代码的编译问题

当我尝试使用 gcc 使用以下命令编译用 c 语言编写的 opengl 代码时,它运行良好:

\n\n
gcc -Wall tutorial10.c -lGL -lglut -lGLU\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是当我尝试使用 g++ 进行相同的编译时

\n\n
g++ -Wall tutorial10.c -lGL -lglut -lGLU\n
Run Code Online (Sandbox Code Playgroud)\n\n

它开始给出很多这样的错误:

\n\n
tutorial10.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)

c++ opengl g++

5
推荐指数
1
解决办法
9657
查看次数

标签 统计

c++ ×1

g++ ×1

opengl ×1