c++ - glfw3.dll 运行代码时未发现系统错误
问题描述
我在 Visual Studio Code(代码编辑器,而不是 IDE)中设置了 GLFW。当我运行代码时,它给了我一个系统错误:- glfw3.dll not found。
这是我从 GLFW 文档中复制的代码:
#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;
}
这是我的 tasks.json 文件:-
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/nologo",
"/I${workspaceFolder}\\glfw\\include",
"/Fe:",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"${workspaceFolder}\\*.cpp",
"opengl32.lib",
"${workspaceFolder}\\glfw\\lib-vc2019\\glfw3dll.lib"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: cl.exe"
}
]
}
解决方案
推荐阅读
- wordpress - 限制 WordPress 多站点仪表板中的权限
- typescript - Typescript如何导出从类工厂返回的类的类型
- spring - Spring jdbcTemplate NPE 异常
- javascript - Mobx-react 无渲染但状态已更改
- java - 更新到 Firebase 数据库时出错
- php - WordPress PHP | get_permalink() 剥离斜线。不能添加额外的斜线
- python - 在下面的代码仍在运行时使用 while true 循环(python)
- python - 存储员工 ID
- java - 遇到换行符时正则表达式被破坏
- php - 使用 CodeIgniter 的详细信息页面