0

我正在关注这个站点上的 OpenGL 教程 - www.arcsynthesis.org/gltut/,在构建教程部分,我下载了 0.3.8 版本的教程。我将其内容提取到桌面的一个文件夹中...我下载了 premake4,然后将其放在了我提取内容的文件夹中。然后我打开 cmd 并 cd 到我提取内容的目录。因为,我使用的是 CodeBlocks,所以我输入了 premake4 gmake,然后它开始构建东西......我将框架文件夹的内容复制到其各自的目录中。然后我通过命令提示符进入 Tut 01 Hello Triangle 目录并执行 premake4 命令。之后,我用 CodeBlocks 打开了 tut1.cpp,编译后我得到了一些这样的错误:

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleCreateShader'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleShaderSource'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleCompileShader'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetShaderiv'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetShaderiv'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetShaderInfoLog'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleCreateProgram'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleAttachShader'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleLinkProgram'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetProgramiv'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetProgramiv'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGetProgramInfoLog'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleDetachShader'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleDeleteShader'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGenBuffers'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleBindBuffer'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleBufferData'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleBindBuffer'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleGenVertexArrays'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleBindVertexArray'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleClearColor'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleClear'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleUseProgram'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleBindBuffer'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleEnableVertexAttribArray'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleVertexAttribPointer'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleDrawArrays'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleDisableVertexAttribArray'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleUseProgram'

C:\Users\PB9X\Desktop\Tutorial 0.3.8\Tut 01 Hello Triangle\tut1.o:tut1.cpp|| undefined reference to `__gleViewport'

||=== Build finished: 30 errors, 0 warnings (0 minutes, 1 seconds) ===|

我到底哪里做错了?我已经在其各自的目录中有 GLEW、FreeGLUT、glimg、glload、glm、glmesh 和 gutil...

4

1 回答 1

1

因为,我使用的是 CodeBlocks,所以我输入了 premake4 gmake

正如 Premake4 网站上所述,代码块有它自己的命令:premake4 codeblocks. 如果您使用的是 Codeblocks,则应该使用 Codeblocks 构建系统,而不是尝试将 gmake makefile 临时化到 Codeblocks 中。

于 2013-05-13T03:13:34.273 回答