我正在关注本网站的OpenGL教程 - www.arcsynthesis.org/gltut/,在建筑教程部分,我下载了0.3.8版本的教程。我在桌面上的文件夹中提取了它的内容...我下载了premake4,然后我把它放在我提取内容的文件夹中。然后我打开cmd然后cd到我解压缩内容的目录。因为,我正在使用CodeBlocks,我输入premake4 gmake然后它开始构建东西......我将framework文件夹的内容复制到它各自的目录中。然后我通过命令提示符转到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 ......
答案 0 :(得分:1)
因为,我正在使用CodeBlocks,我输入了premake4 gmake
代码块as stated on the Premake4 site拥有自己的命令:premake4 codeblocks
。如果您正在使用Codeblocks,那么您应该使用Codeblocks构建系统,而不是尝试将gmake makefile juryrig为Codeblocks。