S
S
sddvxd2018-12-26 00:07:49
css
sddvxd, 2018-12-26 00:07:49

Why does undefined reference occur?

Hello
I downloaded the binary files of the glut library, included the glut.h header file and specified qmake LIBS += -l glut32(the library in the source folder), but the linker gives an undefined reference error. The assembler finds the library itself, please tell me what could be the matter

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2016-03-06
@sijuz

The prize of the shitcode of the year is yours unambiguously, and the problem is that the variables x and y are defined before the click is processed and then do not change, and even the fact that you change the variables num and numm will not give you anything, since x and y will remain the same. Here you are constantly adding the same variables to your transform

R
Roman, 2018-12-26
@sddvxd

ps the name of the library has changed

g++ main.cpp -o main.exe -lglfw3 
//Компиляция происходит без проблем, а линковка дает ошибки

1) https://www.glfw.org downloaded.
2) https://cygwin.com downloaded/installed/configured
3)
main.cpp
#include "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;
}

4) g++ main.cpp -o main.exe -L"C:\project\libs" -lglfw3 -lgdi32 -lopengl32
5) opengl32.a is in cygwin\lib\w32api
6) if something like undefined reference to `[email protected]'opengl32 pops up during linking .a must be placed in project\libs
hello world!
5c2340023d794484052603.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question