Im having again another problem. This time, I have a .dll, a shared library that contains a .qrc (QT Resource) file, the problem is, that when I'm trying to access one of the resources of the library, it doesn't work. I tried implementing the:
Q_INIT_RESOURCE(resourcefilename)
and it stills not working. (It says that the "qInitResources_resourcefilename()" is not found.)
In the Location field, specify a location for the file. Select Add to create a . qrc file and to open it in the Qt Resource Editor. To add resources to the file, select Add > Add Files.
The rcc tool is used to embed resources into a Qt application during the build process. It works by generating a C++ source file containing data specified in a Qt resource (. qrc) file.
RESOURCES = application.qrc. qmake will produce make rules to generate a file called qrc_application. cpp that is linked into the application. This file contains all the data for the images and other resources as static C++ arrays of compressed binary data.
Click the Edit Resources button (first on the left) Click the New Resource File button (first on the left) Enter a file name (e.g. resources. qrc) and click Save.
Nevermind. I found the solution. The qInitResources_name() was not found. So, I created a function inside the shared library
int RmiLib::startResources(){
extern int qInitResources_rmi();
return qInitResources_rmi();
}
Then, on the main App, I called that function, and yay! It worked.
I am going to assume that you are using Windows because you say you have a .dll
I just ran into this same problem that the function qInitResources_resourcefilename cannot be found. This function does indeed exist in the shared library if your library has a .qrc file (check the mapfile). The problem is that this function is not exported and so the linker does not find it while linking the main App. I added the function qInitResources_resourcefilename to the export table of the shared library as follows.
Add a new file to the shared library export.def
LIBRARY
EXPORTS
qInitResources_resourcefilename
Add the following to your shared library .pro file
QMAKE_LFLAGS += /DEF:\"$${PWD}\\export.def\"
OTHER_FILES += \
export.def
Your solution works around this problem because RmiLib::startResources is included in the export table.
I am using Windows 7, MSVC 2010, Qt 5.2.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With