您可以尝试(ld(2)):
--whole-archive For each archive mentioned on the command line after the --whole-archive option, include every object file in the archive in the link, rather than searching the archive for the required object files. This is normally used to turn an archive file into a shared library, forcing every object to be included in the resulting shared library. This option may be used more than once.
(gcc -Wl,-完整档案)
另外,您应该
-Wl,--no-whole-archive在库列表的末尾。(如德米特里·尤达科夫在下面的评论中所述)



