I got a gcc error. It is a strange error.
When I compile the 'muxing.c' without "–Wl,-rpath=./ffmpeg/lib", the code is successfully compiled.
gcc -o muxing muxing.c -I ./ffmpeg/include -L ./ffmpeg/lib -lavcodec -lavfilter -lavutil -lswresample -lavdevice -lavformat -lpostproc -lswscale -lm -lpthread -lasound
nvidia@nx:~/Desktop/project$ ls
ffmpeg Makefile muxing muxing.c test.cpp
But once I add "–Wl,-rpath=./ffmpeg/lib", the compiler give this error: –Wl,-rpath=./ffmpeg/lib: No such file or directory
gcc -o muxing muxing.c -I ./ffmpeg/include -L ./ffmpeg/lib -lavcodec -lavfilter -lavutil -lswresample -lavdevice -lavformat -lpostproc -lswscale -lm -lpthread -lasound –Wl,-rpath,'./ffmpeg/lib'
gcc: error: –Wl,-rpath=./ffmpeg/lib: No such file or directory
Makefile:7: recipe for target 'muxing' failed
make: *** [muxing] Error 1
The gcc option -I and -L can find the path, but '–Wl,-rpath=' cannot find this path. Why?
CodePudding user response:
You have a typo in your option, probably because you copied it from a formatted text.
The leading "-" is not the correct character. So GCC interprets it as a filename character and tries to open a file with the name of the complete option "–Wl,-rpath,'./ffmpeg/lib'", as the error message tells.