在 .pro 文件中添加多个库的问题 - qmake

Issue adding multiple librarys in .pro file - qmake

上下文

问题

当我想将 2 个或更多库添加到 .pro 文件时,我遇到了一个问题。 这是 .pro 中告诉 link 图书馆的那一行:

LIBS += -L /path/to/folder1 -l1 -L /path/to/folder2 -l2

在编译期间,库的 link 部分命令行被破坏(/path/to/folder2 缺少 -L):

g++ -m64 -Wl,-O1 -o bin/a.out main.o
-L/usr/lib/x86_64-linux-gnu -L /path/to/folder1 -l1 /path/to/folder2 -l2
-lQtGui -lQtCore -lpthread

我遇到了同样的问题:

LIBS += -L /path/to/folder1 -l1
LIBS += -L /path/to/folder2 -l2

我运行qmake任何变化后。

有什么想法吗?

不要在 -L 和路径之间放置空格:

LIBS += -L/path/to/folder1 -l1 -L/path/to/folder2 -l2