QT添加lib库后提示 No rule to make target “xxx.lib“ needed by “xxx.exe“

QT添加外部的lib库:
首先右键项目,选择添加库
QT添加lib库后提示 No rule to make target “xxx.lib“ needed by “xxx.exe“_第1张图片

进行选择:
QT添加lib库后提示 No rule to make target “xxx.lib“ needed by “xxx.exe“_第2张图片
这里加入的是静态库
QT添加lib库后提示 No rule to make target “xxx.lib“ needed by “xxx.exe“_第3张图片
添加库后编译一直报错No rule to make target ‘xxx.lib’ needed by ‘xxx’
查找资料后发现是pro文件中添加lib库的语句错误
错误的语句:

win32: LIBS += -L$$PWD/../../Detours/Detours-master/lib.X86/ -ldetours

INCLUDEPATH += $$PWD/../../Detours/Detours-master/lib.X86
DEPENDPATH += $$PWD/../../Detours/Detours-master/lib.X86

win32:!win32-g++: PRE_TARGETDEPS += $$PWD/../../Detours/Detours-master/lib.X86/detours.lib
else:win32-g++: PRE_TARGETDEPS += $$PWD/../../Detours/Detours-master/lib.X86/libdetours.a

正确的语句:

win32: LIBS += -L$$PWD/../../Detours/Detours-master/lib.X86/detours

INCLUDEPATH += $$PWD/../../Detours/Detours-master/lib.X86
DEPENDPATH += $$PWD/../../Detours/Detours-master/lib.X86

PRE_TARGETDEPS += $$PWD/../../Detours/Detours-master/lib.X86/detours.lib

你可能感兴趣的:(QT,qt)