明月泣羽 2022-03-18 11:45
浏览 146
已结题

学习opengl运行glfw官网文档中生成窗口的代码时出现报错LNK2019: 无法解析的外部符号 vkGetInstanceProcAdd

问题遇到的现象和发生背景

学习opengl运行glfw官网文档中生成窗口的代码时出现报错:
error LNK2019: 无法解析的外部符号 vkGetInstanceProcAddr,函数 glfwGetInstanceProcAddress 中引用了该符号
vs是2022版本,cmake是3.22.3版本,glfw是3.3.6版本

问题相关代码,请勿粘贴截图
#include <GLFW/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;
}
运行结果及报错内容

img

我的解答思路和尝试过的方法

我认为应该是缺少相关库,但没找到应该在input那里链接什么库,考虑是cmake编译glfw出现问题,生成glfw的解决方案时也有一样的报错,但也不知道怎么解决。

我想要达到的结果

想要解决这个错误,并可以正常运行这段代码。

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 3月26日
    • 创建了问题 3月18日

    悬赏问题

    • ¥15 三极管电路求解,已知电阻电压和三级关放大倍数
    • ¥15 ADS时域 连续相位观察方法
    • ¥15 Opencv配置出错
    • ¥15 模电中二极管,三极管和电容的应用
    • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
    • ¥15 气象网格数据与卫星轨道数据如何匹配
    • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
    • ¥15 微软账户问题不小心注销了好像
    • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
    • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused