0

I can't figure out how to link external libs / installed packages when compiling. I have G++ and atom with the gpp-compiler package by kriscross07 and I want to link my GLWF3 Hello World programm with libglfw3-dev, that I installed through APT.

I've tried to read through the GCC manual and find something on the atom package but I failed to find anything on this specific goal.

This seems to be something very simple, and I'm probably just overlooking something very obvious, as I'm very new to Linux.

Edit: My .cpp file, that I try to compile:

   #include <GLFW3/glfw3.h>


    int main(void)
    {
    GLFWwindow* window;

    /* Initialize the library */
    if (!glfwInit())
        return -1;

    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    /* Make the window's context current */
    glfwMakeContextCurrent(window);

    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window))
    {
        /* Render here */
        glClear(GL_COLOR_BUFFER_BIT);

        /* Swap front and back buffers */
        glfwSwapBuffers(window);

        /* Poll for and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

This is a 'Hello World' program I copied somewhere. I get that error message when I try to compile it:

/long directory/main.cpp:1:10: fatal error: GLFW3/glfw3.h: No such file or directory.
 #include <GLFW3/glfw3.h>
          ^~~~~~~~~      
compilation terminated.

1 Answer 1

0

It looks like your include statement is incorrect (it has an extra 3). It should read:

#include <GLFW/glfw3.h>

See the GLFW documentation for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .