繁体   English   中英

无法链接GLFW3:未定义的引用

[英]Can't link GLFW3: undefined references

我之前已经意识到类似的东西( glfw3编译未定义的引用 ),但我仍然无法让它工作。 欢迎任何帮助!

下面是运行make时的编译器输出:

g ++ -std = c ++ 11 -Wall -Wextra -Werror -pedantic-errors -I / usr / local / include -c -o Main.o Main.cpp

g ++ -std = c ++ 11 -Wall -Wextra -Werror -pedantic-errors -I / usr / local / include -L / usr / local / lib -lglfw3 -lGL Main.o -o modernogl

Main.o:在函数`main'中:

Main.cpp :(。text + 0x9):对'glfwInit'的未定义引用

Main.cpp :(。text + 0x3b):对`glfwCreateWindow'的未定义引用

Main.cpp :(。text + 0x4b):对'glfwTerminate'的未定义引用

Main.cpp :(。text + 0x5e):对`glfwMakeContextCurrent'的未定义引用

Main.cpp :(。text + 0x6c):对`glfwSwapBuffers'的未定义引用

Main.cpp :(。text + 0x71):对`glfwPollEvents'的未定义引用

Main.cpp :(。text + 0x7d):对`glfwWindowShouldClose'的未定义引用

Main.cpp :(。text + 0x92):对`glfwDestroyWindow'的未定义引用

Main.cpp :(。text + 0x97):对`glfwTerminate'的未定义引用

collect2:错误:ld返回1退出状态

make:*** [modernogl]错误1

以下是include和lib目录中的内容: http//imgur.com/e6qXSjB,fASlBUm#1

以下是来源(虽然它应该没有任何问题......):

#include <GLFW/glfw3.h>

int main() {
    if (!glfwInit()) {
        return 1;
    }

    GLFWwindow* window {glfwCreateWindow(640, 480, "Modern OpenGL", nullptr, nullptr)};
    if (!window) {
        glfwTerminate();
        return 1;
    }

    glfwMakeContextCurrent(window);
    while (!glfwWindowShouldClose(window)) {
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glfwDestroyWindow(window);
    glfwTerminate();
    return 0;
}

非常感谢你的帮助! - 埃里克

我只有库“libglfw3.a”的静态版本,我需要它的共享版本“libglfw.so”。 确保使用BUILD_SHARED_LIBS = ON构建GLFW3!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM