If you’re using little-l “-l” in this flag, this means you are trying to link to a library called “/usr/local/lib/”, which is a path, not a library. If your intention is to use that as a path to find libraries, the correct flag is big-L “-L”, to set /usr/local/lib/ as a path in which to search for libraries. (This might just be a typo on your part in composing your message, but just in case its not, you’d definitely need to fix this..)
Then, to link to “libphonon.dylib”, you’d add “-lphonon” as an option - with these two flags properly set, you’d be telling the linker to search /usr/local/lib for a library named phonon, which it will automatically convert to mean the file named “libphonon.dylib”.
So - first - be sure your linker flags are set thus: “-L/usr/local/lib/ -lphonon” ..
However, since this is a dynamically loaded library (.dylib), you must also set the runtime path for library loading so that libphonon.dylib is bound with your application image at runtime. (You would also need to ship the library and put it in /usr/local/lib/ .. but once you get this working for development, you can work out how to package libphonon.dylib in your projects’ own bundle directory, which is another can of worms..)
You set this runtime linker flag with the -rpath option (as mentioned previously), so for example:
gcc -o myprogram myprogram.c -L/usr/local/lib/ -lphonon -Wl,-rpath,/usr/local/lib/
If you’re using Projucer to configure your project, you add this string to the “Extra Linker Flags” section:
-Wl,-rpath,/usr/local/lib/
- but be sure to also add the “phonon” identifier to the “External Libraries to Link” field - as both are needed to make this work.