Solved QT Resource not loading in static build of QT 1.15.1
-
Hello i am trying to build my app on a static version of qt but there seems to be a issue the resources are not loaded, nor are they loaded in a dynamic build outside of creator debugging i have no idea why. how can i fix this?
-
Hi
Do you have something like
RESOURCES +=
icons.qrcin the .pro file ?
-
RESOURCES +=
images.qrc
i have this in my pro file -
Hi
Ok seems fine.
If you go to the build folder and look
Do you then have
qrc_images.obj ? -
No, but i do have qrc_images.o and qrc_images.cpp.
-
@raketmus
Ok super. it means it does compile it.
so how do you see its not working ?
The images dont show up not even when running from Creator ? -
On static compile they dont show up in creator on dynamic they do, but not when opening from outside creator.
-
hi
On dynamic, outside of creator did you make a deployment folder to run it from?
Some file types like jpg require a plugin next to the .exe to work outside.
You can use the deployment folder to create this folder
https://doc.qt.io/qt-5/windows-deployment.htmlFor your static version, its hard to guess on but maybe you didn't include the
image plugins in the build. -
Well my app uses one png and svgs for the rest i tried putting Qt5Svg.dll in there but no effect
-
@raketmus
Try the tool as each .dll might need other dlls. -
Well there is something i am missing in my code because msvc wont do the trick eiter i am not sure what i am doing wrong. Is there somekind of know working example of qtresources
-
@raketmus
Hi
I have a test project.
https://www.dropbox.com/s/msmtzl5zxu6blp6/restest.zip?dl=0it should look like this
-
I think this is a issue with svgs as all other images work i will rebuild qt static with -qt-svg added.
editited due to post wait. -
@raketmus
It also works fine with a subfolder in the project folder.
But you must adjust the path you use then.
":/images/filename.ext"updated project
https://www.dropbox.com/s/bz6h6cihg4zvlw4/restest2.zip?dl=0 -
well it is the svg that is the problem but i dont know how to make qt build qtsvg as when i try to build https://github.com/qt/qtsvg
i get qsvgrender.h not found if i then manualy change the include location to fix that, i know how no idea how i am suppose to include this module i cant seem to find any examples or guides online nor in the project folder -
I have solved this by running the following command on qt 1.15.1 source
C:\Qt\qt-everywhere-src-5.15.1\configure.bat -release -static -opensource -confirm-license -static-runtime -qt-zlib -qt-libjpeg -qt-tiff -qt-webp -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -gui -widgets -no-pch -opengl desktop -platform win32-g++ -prefix "C:\Qt\QT-Static" -skip webengine -nomake tools -nomake tests -nomake examples -openssl-linked -I "C:\OpenSSL-Win64\include" -L "C:\OpenSSL-Win64\lib" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-lssl -lcrypto" OPENSSL_LIBS_RELEASE="-lssl -lcrypto" mingw32-make -j8 mingw32-make install pause
in a .ps1 script.
this builds qt with openssl linked i used the prebuildt libaries from here https://bintray.com/vszakats/generic/openssl/1.1.1g
put in a folder with the libs renamed to crypto.a and ssl.a .