zero57
zero57

Reputation: 351

OpenGL Loader Generator undefined reference to gl::BindBuffer, etc (OpenGL Functions)

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.

Upvotes: 1

Views: 955

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473322

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.

Upvotes: 1

Related Questions