I am trying to compile a C program that requires the use of several libraries. The problem is, the order the libraries are linked in causes the compilation to fail.
Is there anyway to get GCC to figure out the correct order, or for me to figure out the correct order without having to try every possibility?
mipsel-linux-gcc ffmpeg_mips_test.c -o ffmpeg_mips_test -Wall -v -I/ffmpegMIPS/includeffmpegMIPS/
-L/ffmpegMIPS/libffmpegMIPS/ -lavformat -lavcodec -lavutil -lswscale -lm -lpthread
The way I am doing it at the moment, is starting off with one, and then adding more libraries as the errors occur, however sometimes it feels like progress and then sometimes it just seems like I hit a dead end.
[edit]The compilation fails because of undefined references[/edit]
You have a few options
1) You can add additional calls to your library(s) that have dependencies
2) You can use the
--start-group / --end-groupoptions like so:Here is the
ldmanpage entry describing its use