Ld: symbol(s) not found for architecture arm64 on Mac M1

I am using a Mac M1. I have been trying to use GLFW using visual studio code for very long. These are the steps that I have used:

  1. Downloaded the Source code from Github
  2. Used cmake to make project files and finally make the binaries. The commands I used were

make && sudo make install

This has generated the include and src folder in usr/local/ for glfw and I am able to use the library in vscode and get the intellisense. Only If I try to compile the code, I get an error.

Currently my folder structure for glfw looks like this. I don’t have the .dylib file which I had previously when I had installed the pre-compiled binaries

├── include
│ └── GLFW
│ ├── glfw3.h
│ └── glfw3native.h
└── lib
├── cmake
│ └── glfw3
│ ├── glfw3Config.cmake
│ ├── glfw3ConfigVersion.cmake
│ ├── glfw3Targets-noconfig.cmake
│ └── glfw3Targets.cmake
├── libglfw3.a
└── pkgconfig
└── glfw3.pc

I have even tried to use the pre-compiled binaries but I got the same error. Please can someone give a blog/doc for me to read about how can setup GLFW on my system. I have almost tried every possible solution.

If it has worked for someone, please tell me how did you do it. I am pasting the exact error screenshot here.

I don’t have enough time to read through the image, but could you first try this:

This should work on an M1 Mac, though I don’t have one to test with.