我正在开发一个项目,在过程中,我需要在VSCode中设置GLFW。我使用MinGw作为编译器,并使用MinGw的cmake配置生成glfw构建文件。我得到了文件,并将它们放在主c:/mingw中。我将glfw3.dll放在bin中,libglfw3dll.a放在lib中,GLFW/glfw3.h和GLFW/glfw3native.h放在include中。"PS: i have placed these files in mingw as well as in my project".,然后我在tasks.json "-lglfw3“中添加了这些行,但是在执行终端显示无法找到-lglfw,如果删除它,那么main.cpp中的glfw和-lglfw函数显示为错误。
task.json
{
"version": "2.0.0",
"command": "g++",
"type": "shell",
"reveal": "always",
"tasks": [
{
"label": "Build",
"group": "build",
"windows": {
"suppressTaskName": true,
"args": [
"-g",
"--std=c++17",
"-I", "${workspaceFolder}",
"-I", "${workspaceFolder}/thirdparty/include",
/*===LIBS===*/
"-lopengl32",
"-lglfw3",
/*===END OF LIBS===*/
"main/main.cpp",
"-o",
"builds/windows/Stupefy",
]
},
"linux": {
"suppressTaskName": true,
"args": [
"-g",
"--std=c++17",
"main/main.cpp",
"-o",
"builds/x11/Stupefy"
]
},
"osx": {
"suppressTaskName": true,
"args": [
"-g",
"--std=c++17",
"main/main.cpp",
"-o",
"builds/osx/Stupefy"
]
}
}
],
}发布于 2020-08-19 13:20:06
确保GLFW/glfw3.h在您的“第三方/包括”文件夹中。如果不是,将路径作为-I参数添加到该文件(或将其移到那里)。
确保%your_glfw_folder%/lib-mingw-w64/glfw3.dll的路径是由-L参数指定的。(或者把它移到更方便的位置。)只要该文件的路径是由-L参数指定的,就可以了)。
确保库glfw3、opengl32、gdi32与-l参数链接(缺少-lgdi32)
为了高兴,请确保其includes文件夹的路径被列为-I参数,或者其内容位于您的“第三方/包含”文件夹中
还向参数列表中添加到src/glad.c的路径。
https://stackoverflow.com/questions/60613700
复制相似问题