Compile LDS2 project with g++ on Mac

107 Views Asked by At

I am trying to setup a C++ project using LDS2. I am having some problems with the compiler. I am working on a M1 Mac and I have installed LDS2 using brew (install location /opt/homebrew/Cellar/sdl2). The project folder structure is as follows:

.
├── Makefile
├── build
├── include
│   └── SDL2 -> /opt/homebrew/Cellar/sdl2/2.0.22/include/SDL2
├── lib
│   └── SDL2 -> /opt/homebrew/Cellar/sdl2/2.0.22/lib/
└── src
    └── main.cpp

I then run the command g++ -std=c++11 -Wall -O0 -g -lSDL2 -Iinclude src/main.cpp -o build/debug/tst to compile the program. However, I get the following error:

ld: library not found for -lSDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1

Thank you in advance for your help!

0

There are 0 best solutions below