You specify the directory to -L and the 'core' name to -l:gcc -o test main.c IPT.c logitem_list.c -L . -lpt当给定 -l pt 时,链接程序将查找 libpt.a 或 libpt.如此或等价物(扩展名如 .dylib 或 .sl 或 .dll 或 .lib 其他平台).When given -lpt, the linker looks for libpt.a or libpt.so or equivalents (extensions like .dylib or .sl or .dll or .lib on other platforms). -L -./表示链接器在名为破折号"的目录中查找,该目录不太可能存在,也不在 libpt.a 仍然可以找到.The -L -./ is suggesting that the linker look in a directory called 'dash dot', which is unlikely to exist and isn't where libpt.a is found anyway. 这篇关于gcc:链接库在与源文件相同的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-25 13:18