Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有两个具有相同库名称但存储在不同目录中的库(并且它们可能包含不同的代码)并且我在 makefile 的 LDFLAGS 变量中列出了这两个目录,那么链接器如何知道首先查找的位置以及要使用的库?
LDFLAGS+= \ -L${INSTALL_DIR}/lib\ -L${EVO_INSTALL_DIR}/lib\
它会先查看 INSTALL_DIR 路径还是查看 EVO_INSTALL_DIR 路径?
INSTALL_DIR. It will look in the order they are listed.
INSTALL_DIR
By the way, it's your linker (probably the same program as your compiler) that's making this choice, not the Makefile. Make (which is reading your Makefile) only runs the build tools.