OpenGL Loader Generator未定义引用gl :: BindBuffer等(OpenGL函数) [英] OpenGL Loader Generator undefined reference to gl::BindBuffer, etc (OpenGL Functions)
问题描述
使用 OpenGL Loader Generator 时遇到问题,当我尝试编译时我的代码,它不工作。它会抛出一个错误,说对我使用的任何opengl函数未定义的引用,如gl :: BindBuffer,gl :: GenBuffers等。我使用pointer_cpp / func_cpp风格。
我使用的简单代码是
#includegl_core_3_3.hpp
#include< GL / glfw.h>
int main(int argc,char * argv []){
glfwInit();
glfwOpenWindow(1024,768,0,0,0,0,0,0,GLFW_WINDOW);
gl :: exts :: LoadTest didLoad = gl :: sys :: LoadFunctions();
if(!didLoad){
glfwTerminate();
return 1;
}
return 0;
}
当我编译时,它说未定义的引用gl :: sys :: LoadFunctions。我用来编译的命令是
g ++ main.cpp -lglfw -lGL -lGLU
我在Arch Linux上使用Vim with clang作为我的IDE。
解决方案
g ++ main.cpp -lglfw -lGL -lGLU
我看不到你包含生成的源文件。它不是一个标题加载系统。它不会生成库,但会生成必须编译的源代码。
I have a problem when using OpenGL Loader Generator, which when I try to compile my code, it doesn't work. It throws an error saying undefined reference to any opengl function I use, such as gl::BindBuffer, gl::GenBuffers, etc. I'm using pointer_cpp/func_cpp style.
My simple code that I'm using is
#include "gl_core_3_3.hpp" #include <GL/glfw.h> int main(int argc, char *argv[]) { glfwInit(); glfwOpenWindow(1024, 768, 0, 0, 0, 0, 0, 0, GLFW_WINDOW); gl::exts::LoadTest didLoad = gl::sys::LoadFunctions(); if(!didLoad) { glfwTerminate(); return 1; } return 0; }
When I compile that, it says undefined reference to gl::sys::LoadFunctions too. The command I'm using to compile is
g++ main.cpp -lglfw -lGL -lGLU
I'm on Arch Linux and using Vim with clang as my IDE.
解决方案g++ main.cpp -lglfw -lGL -lGLU
I don't see where you're including the generated source file. It's not a header-only loading system. It doesn't generate a library, but it does generate source code, which must be compiled.
这篇关于OpenGL Loader Generator未定义引用gl :: BindBuffer等(OpenGL函数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!