I know it's going to be a silly mistake, and I'm aware that there are similar posts however none have helped so far, so I'm resorting to a new post.
I'm trying to compile the simplest GLFW hello world example.
In my project directory (I'm using vscode) there is a main.cpp file, and the glfw lib file I downloaded from glfw.org which I renamed to libglfw3.a (It's precompiled) I am using a MacBook Air M1.
I'm trying to compile it with this command:
clang -I /opt/homebrew/Cellar/glfw/3.3.7/include -L /Users//projects/ -l libglfw3.a main.cpp -o helloglfw
The output I get is:
ld: library not found for -llibglfw3.a clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm clearly dumb because for the life of me I can't see what I'm doing wrong...
Things I've tried:
Some assistance would be appreciated.
OK SO! I fixed it. Apparently it works if there is NO SPACE between the -L and -l parameters.
so the command looks like this:
clang <source files> -I<Include Paths> -L<pathtolibs>-l<libs>
No clue why, but whatever I'm done...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With