我试图在m1 Mac上使用vs代码,用glfw和glad创建一个新的OpenGL项目,并设置文件,这样我就有了包含必要的标题和库(libglfw3.a)文件的include文件夹和lib文件夹,以及包含glad的src文件夹。c和main。cpp,都在我的工作区文件夹中。
我已经修改了任务。json文件如下:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-fdiagnostics-color=always",
"-g",
"-std=c++17",
"-I${workspaceFolder}/include",
"-L${workspaceFolder}/lib",
"${workspaceFolder}/src/*.cpp",
"${workspaceFolder}/src/glad.c",
"-llibglfw3",
"-o",
"${workspaceFolder}/game"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang++"
}
]
}
但是,我得到了以下错误:
ld: library not found for -llibglfw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我以为我已经正确地包含了glfw库的路径,但它说它找不到库。我做错了什么?
作为旁注,我遵循了
this
这篇文章假设你有一台windows机器,所以我下载了一些东西/改变了一些我所知道的关于m1 mac的知识。