QT: No rule to make target 'res/resources.qrc'
-
I've switched versions of QT (from 5.10.1 to 5.12.2) to get a more recent version of Mingw32 (from GCC/G++ 5.3 -> 7.3). The reasoning behind this is that have multiple products using the same library and using an old version of gcc is less than ideal. We've never had any issues with build before, but now I get the following error:
":-1: error: No rule to make target 'res/resources.qrc', needed by 'release/qrc_resources.cpp'. Stop."
Oddly enough, it does not stop the build from generating a completely functioning executable.
So far I've tried:
Cleaning the directory and building again
Deleting the build directory and building again
Not selecting shadow build option
Forcing Qmake (Build -> Run Qmake)
Creating a new .pro.user file
Deleting the whole repo, cloning it again, rebuilding the dependencies (we have a library which it relies on) and rebuilding QT
Adding the .qrc file to the includes (I know this was silly, but I was at my wits end)
Checking for deleted files (None that I can see)
Checking file names for inconsistencies(They seem ok)Here is my qrc file
<RCC> <qresource prefix="/"> <file>images/cnctbtn_connected.png</file> <file>images/cnctbtn_connecting.png</file> <file>images/cnctbtn_disconnected.png</file> <file>images/configbtn.png</file> <file>images/flash.png</file> <file>images/logbtn.png</file> <file>images/streambtn_start.png</file> <file>images/streambtn_stop.png</file> <file>images/d_logo_outlined.ico</file> <file>images/d_logo_small.png</file> <file>images/d_logo_small_outlined.png</file> </qresource> </RCC>
The list of resources which are located in the images folder
cnctbtn_connected.png cnctbtn_connecting.png cnctbtn_disconnected.png configbtn.png d_logo_small.png d_logo_small_outlined.png flash.png logbtn.png streambtn_start.png streambtn_stop.png
The qrc_resource_File.cpp also looks ok. I see the bytes of the images in it, their names and assorted namespace declarations and functions in that name space.
The one thing I'm unsure of is why the images folder has it's on name in the resource name list.
Note: I've removed the bytes in this array, for my eyes and yours.
static const unsigned char qt_resource_name[] = { // images // cnctbtn_disconnected.png // cnctbtn_connected.png // cnctbtn_connecting.png // streambtn_start.png // d_logo_outlined.ico // d_logo_small.png // streambtn_stop.png // d_logo_small_outlined.png };
Ideally there would be no build error, which I don't really understand since I can see and use the executable produced. If you need any other information, don't hesitate to ask!
-
Hi and welcome to devnet,
Can you also show your .pro file ?
-
Yeah no problem!
#------------------------------------------------- # # Project created by QtCreator 2018-04-19T09:26:35 # #------------------------------------------------- QT += core gui charts CONFIG += c++14 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = plan3.0 TEMPLATE = app # TODO: QMAKE_TARGET is not being set, we need # to set it if we want to build a Windows GUI # from linux or visa versa win32 { !contains(QMAKE_HOST.arch, x86_64) { message("windows 32 bit build") PLAT_DIR = win32 } else { message("windows 64 bit build") PLAT_DIR = win64 } } unix{ !contains(QMAKE_HOST.arch, x86_64) { message("unix 32 bit build") PLAT_DIR = unix64 } else { message("unix 64 bit build") PLAT_DIR = unix64 } } # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. include(../plan_definitions.pri) # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += DephyDebug=0xFFFFFF # Software icon in the toolbar and on the main window RC_ICONS = res/images/d_logo_outlined.ico INCLUDEPATH += \ inc \ ../fx_plan_stack/include \ ../fx_plan_stack/include/flex_lib \ ../fx_plan_stack/flexsea-system/inc \ ../fx_plan_stack/serial/include \ ../fx_plan_stack/flexsea-comm/inc \ ../fx_plan_stack/flexsea-projects/ActPack/inc \ ../fx_plan_stack/flexsea-dephy/CycleTester/inc \ ../fx_plan_stack/flexsea-dephy/DpEb42/inc \ ../fx_plan_stack/flexsea-system/inc \ ../fx_plan_stack/flexsea-shared/i2t/inc \ ../app/res \ ../fx_plan_stack/flexsea-projects/inc SOURCES += \ src/betterchart.cpp \ src/betterchartview.cpp \ src/configdialog.cpp \ src/connectionbar.cpp \ src/devicedisplaywindow.cpp \ src/flexsealogprovider.cpp \ src/logbar.cpp \ src/main.cpp \ src/mainwindow.cpp \ src/planportlistener.cpp \ src/planSubWindow.cpp \ src/planuicomponent.cpp \ src/revision.cpp \ src/w_2dplot.cpp \ src/w_ankleangleplot.cpp \ src/w_btconfig.cpp \ src/w_calibration.cpp \ src/w_commtest.cpp \ src/w_control.cpp \ src/w_cycletester.cpp \ src/w_operatorconsole.cpp \ src/w_userrw.cpp \ src/w_usertesting.cpp \ src/debuglog.cpp HEADERS += \ inc/betterchart.h \ inc/betterchartview.h \ inc/configdialog.hpp \ inc/connectionbar.h \ inc/counter.h \ inc/devicedisplaywindow.h \ inc/flexsealogprovider.h \ inc/git_rev_data.h \ inc/logbar.h \ inc/mainwindow.h \ inc/planPortListener.h \ inc/planuicomponent.h \ inc/quickeventfilter.h \ inc/revision.h \ inc/w_2dplot.h \ inc/w_ankleangleplot.h \ inc/w_btconfig.h \ inc/w_calibration.h \ inc/w_commtest.h \ inc/w_control.h \ inc/w_cycletester.h \ inc/w_operatorconsole.h \ inc/w_userrw.h \ inc/w_usertesting.h \ inc/debuglog.h \ ../fx_plan_stack/flexsea-shared/i2t/inc/i2t-current-limit.h \ ../fx_plan_stack/flexsea-shared/i2t/inc/i2t-squares.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_device_spec.h \ ../fx_plan_stack/serial/include/serial/impl/unix.h \ ../fx_plan_stack/serial/include/serial/impl/win.h \ ../fx_plan_stack/serial/include/serial/serial.h \ ../fx_plan_stack/serial/include/serial/v8stdint.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_calibration.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_control.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_data.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_external.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_in_control.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_sensors.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_stream.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_sysdata.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_cmd_tools.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_dataformats.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_device_spec.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_embedded_mutex.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_global_structs.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_sys_def.h \ ../fx_plan_stack/flexsea-system/inc/flexsea_system.h \ ../fx_plan_stack/flexsea-system/inc/fm_block_allocator.h \ ../fx_plan_stack/flexsea-system/inc/systemStackConfig.h \ ../fx_plan_stack/include/flexseastack/circular_buffer.h \ ../fx_plan_stack/include/flexseastack/com_wrapper.h \ ../fx_plan_stack/include/flexseastack/comm_string_generation.h \ ../fx_plan_stack/include/flexseastack/commanager.h \ ../fx_plan_stack/include/flexseastack/commtester.h \ ../fx_plan_stack/include/flexseastack/datalogger.h \ ../fx_plan_stack/include/flexseastack/flexseadevice.h \ ../fx_plan_stack/include/flexseastack/flexseadeviceprovider.h \ ../fx_plan_stack/include/flexseastack/flexseadevicetypes.h \ ../fx_plan_stack/include/flexseastack/flexseaserial.h \ ../fx_plan_stack/include/flexseastack/fx_device_defs.h \ ../fx_plan_stack/include/flexseastack/fxdata.h \ ../fx_plan_stack/include/flexseastack/lockedqueue.h \ ../fx_plan_stack/include/flexseastack/periodictask.h \ ../fx_plan_stack/include/flexseastack/rxhandler.h \ ../fx_plan_stack/include/flexseastack/serialdriver.h \ ../fx_plan_stack/include/flexseastack/testserial.h \ ../fx_plan_stack/flexsea-comm/inc/commStackConfig.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_buffers.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_circular_buffer.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_comm.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_comm_def.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_comm_multi.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_interface.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_multi_circbuff.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_multi_frame_packet_def.h \ ../fx_plan_stack/flexsea-comm/inc/flexsea_payload.h \ ../fx_plan_stack/include/flexsea_config.h \ ../fx_plan_stack/flexsea-projects/ActPack/inc/cmd-ActPack.h \ ../fx_plan_stack/flexsea-dephy/CycleTester/inc/cmd-CycleTester.h \ ../fx_plan_stack/flexsea-dephy/DpEb42/inc/cmd-DpEb42.h \ ../fx_plan_stack/flexsea-dephy/DpEb42/inc/cmd-GaitStats.h \ ../fx_plan_stack/flexsea-dephy/DpEb42/inc/cmd-UTT.h \ ../fx_plan_stack/flexsea-projects/inc/dynamic_user_structs.h \ ../fx_plan_stack/flexsea-projects/inc/flexsea_cmd_user.h \ ../fx_plan_stack/flexsea-projects/inc/flexsea_user_structs.h \ ../fx_plan_stack/flexsea-projects/inc/projectsStackConfig.h \ ../fx_plan_stack/flexsea-projects/inc/user-plan.h \ ../fx_plan_stack/flexsea-projects/inc/user-testPC.h \ ../fx_plan_stack/include/flex_lib/flexsea_board.h \ ../fx_plan_stack/include/flex_lib/flexsea_config.h \ ../fx_plan_stack/include/flex_lib/flexsea_device_spec_defs.h \ ../fx_plan_stack/include/flex_lib/trapez.h FORMS += \ ui/configdialog.ui \ ui/devicedisplaywindow.ui \ ui/mainwindow.ui \ ui/w_2dplot.ui \ ui/w_ankleAnglePlot.ui \ ui/w_btconfig.ui \ ui/w_calibration.ui \ ui/w_commtest.ui \ ui/w_control.ui \ ui/w_cycletester.ui \ ui/w_operatorconsole.ui \ ui/w_userrw.ui \ ui/w_usertesting.ui LIBS += -L$$PWD/../fx_plan_stack/build/libs/ -lfx_plan_stack_static win32{ LIBS += -lsetupapi } # TODO: not sure if this is needed but when using cmake # pthread library needed to be linked in unix{ LIBS += -lpthread } PRE_TARGETDEPS += $$PWD/../fx_plan_stack/build/libs/libfx_plan_stack_static.a # Update revision information win32{ PRE_TARGETDEPS += git_rev_data.h QMAKE_EXTRA_TARGETS += revisionTarget revisionTarget.target = git_rev_data.h revisionTarget.commands = cd $$PWD && python.exe $$PWD/git-revision.py -o $$PWD/inc/git_rev_data.h revisionTarget.depends = FORCE } #unix{ #revisionTarget.commands = python $$PWD/git-revision.py -o $$PWD/inc/git_rev_data.h #} RESOURCES += \ res/resources.qrc
-
Looks good...
What if you prepend
$$PWD/
to your resources path ?
And just in case, try using another name for the file itself. -
I've switched versions of QT (from 5.10.1 to 5.12.2) to get a more recent version of Mingw32 (from GCC/G++ 5.3 -> 7.3). The reasoning behind this is that have multiple products using the same library and using an old version of gcc is less than ideal. We've never had any issues with build before, but now I get the following error:
":-1: error: No rule to make target 'res/resources.qrc', needed by 'release/qrc_resources.cpp'. Stop."
Oddly enough, it does not stop the build from generating a completely functioning executable.
So far I've tried:
Cleaning the directory and building again
Deleting the build directory and building again
Not selecting shadow build option
Forcing Qmake (Build -> Run Qmake)
Creating a new .pro.user file
Deleting the whole repo, cloning it again, rebuilding the dependencies (we have a library which it relies on) and rebuilding QT
Adding the .qrc file to the includes (I know this was silly, but I was at my wits end)
Checking for deleted files (None that I can see)
Checking file names for inconsistencies(They seem ok)Here is my qrc file
<RCC> <qresource prefix="/"> <file>images/cnctbtn_connected.png</file> <file>images/cnctbtn_connecting.png</file> <file>images/cnctbtn_disconnected.png</file> <file>images/configbtn.png</file> <file>images/flash.png</file> <file>images/logbtn.png</file> <file>images/streambtn_start.png</file> <file>images/streambtn_stop.png</file> <file>images/d_logo_outlined.ico</file> <file>images/d_logo_small.png</file> <file>images/d_logo_small_outlined.png</file> </qresource> </RCC>
The list of resources which are located in the images folder
cnctbtn_connected.png cnctbtn_connecting.png cnctbtn_disconnected.png configbtn.png d_logo_small.png d_logo_small_outlined.png flash.png logbtn.png streambtn_start.png streambtn_stop.png
The qrc_resource_File.cpp also looks ok. I see the bytes of the images in it, their names and assorted namespace declarations and functions in that name space.
The one thing I'm unsure of is why the images folder has it's on name in the resource name list.
Note: I've removed the bytes in this array, for my eyes and yours.
static const unsigned char qt_resource_name[] = { // images // cnctbtn_disconnected.png // cnctbtn_connected.png // cnctbtn_connecting.png // streambtn_start.png // d_logo_outlined.ico // d_logo_small.png // streambtn_stop.png // d_logo_small_outlined.png };
Ideally there would be no build error, which I don't really understand since I can see and use the executable produced. If you need any other information, don't hesitate to ask!
@Flabelle
this seems like a bug that sometimes happens when you update qt versions on Windows. Sometimes paths get messed up badly.
Usually a complete reinstall fixes this Qt and if you use it QtCreator. Not my preferred activity to spend time on, but sometime necessary. Never had to do it on Mac yet cross fingersDid you try that already as well?
-
@SGaist I'll play with the file names, but after seeing @J-Hilk 's comment I'm going to try that first. I'm in fact using Windows 10, I failed to mention that in my original post.
@J-Hilk Which Path are you referring to? The paths in the .pro file, the system path, or a variable Qt uses to find files or resources?
I'll do that while I'm out for lunch and get back to you guys on how it turned out.
-
@SGaist Is this what you meant by prepend the current working directory? I didn't work for me. I've also tried renaming the resources files with no success, however it gives the same error. Is it possible that the resource.qrc file is defined outside the .pro file?
'''
RESOURCES +=
$$PWD/res/resources.qrc
'''
I've noticed something odd, is that it finds the image, but the path to get to the image looks bizarre in the project browser, there appears to be an extra symbol '/'. Could this be part of the problem?@J-Hilk A total uninstall/reinstall didn't fix it. I used the QT tool to do that, so I'm pretty sure I covered my bases.
-
That's what I meant.
That's the root path in the qrc.
Try to follow my other suggestions: give it another name.