“no rule to make target…” error with undocumented files(glob) function

雨燕双飞 提交于 2019-12-06 08:27:37

I found out recently that qmake expands simple expressions like *.cpp automatically, without needing any specially globbing functions.

So I would suggest changing your SOURCES line to this:

SOURCES += someotherstuff.cpp
SOURCES += ../Core/*.cpp
SOURCES += ../Core/DriveProgramInterface/*.cpp
SOURCES += ../Core/DriveProgramWizard/*.cpp

In some cases just adding: SOURCES += ../OtherDir/*.cpp does not work and running the generated Makefile complains that:

No rule to make target '/../OtherDir/*.cpp', needed by 'release/*.o' [or 'debug/*.o']

In such a case, the solution is to wrap the $$qoute($$PWD/...) around the paths which have wild card *:

SOURCES += $$quote($$PWD/../OtherDir/*.cpp)
HEADERS += $$quote($$PWD/../OtherDir/*.h)

This way a working Makefile is created and the build is successful.

I think one of the cases is when one adds *.cpp/*.h to a sub-project which is nested in a super project (i.e a project with TEMPLATE=subdir in its project .pro file).

It may also help, mentioning that I work on Windows/MinGW32 platform and the problem may be related to this platform.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!