qt_add_qml_module not working for windows, when linked into an app
-
Hey, I am running into a problem with
qt_add_qml_moduleon windows, the same code runs all fine on linx tho.
Using it normally (in a monolithic application) works fine, but when I try to separate my application into one shared library, which creates a qml_module and is then linked into the main app, it doesnt work anymore. When trying to use the module, which is defined in my library, in my .qml file, I get the compile time error: "module "TestApp.Models" is not installed".
I am using QML_ELEMENT in my cpp classes to register it, and:
# Qml-Module qt6_add_qml_module(something URI TestApp.Models VERSION 1.0 )to create the module. I then link this module into my main application, by using target_link_libraries
I've created a minimal reproducable version of it here: https://github.com/Creapermann/Temp/. I hope someone knows why this happens.
Thanks in advance
-
Since it's about the same subject, it would be better to continue over there since the outcome looks good.
-
Hi,
Since you are creating a library you shall follow the recommendation from the Qt documentation about the shared library creation and not use Q_DECL_EXPORT blindly.
-
Hi,
Since you are creating a library you shall follow the recommendation from the Qt documentation about the shared library creation and not use Q_DECL_EXPORT blindly.
@SGaist Thanks for the reply. I tried following the doucmentation and pushed it to my github repo. If there is anything else that I am missing, please tell me. I have not been actively using export macros before.
Thanks in advance -
In fact you did not. The documentation explicitly shows you how to create a header file that makes use of the import and export macros Qt provides. Do that first.
-
In fact you did not. The documentation explicitly shows you how to create a header file that makes use of the import and export macros Qt provides. Do that first.
@SGaist Oh, my bad. I didnt push the changes. They should be visible now
-
Also, I just realized that mingw (what I am using to compile the example), does export all symbols by default. So I dont think thats the problem
-
Isn't that the same issue as this thread ?
-
Isn't that the same issue as this thread ?
@SGaist, we figured out that the other threads problem has the same cause as this. Am I supposed to close this one?
-
Since it's about the same subject, it would be better to continue over there since the outcome looks good.
-
Since it's about the same subject, it would be better to continue over there since the outcome looks good.
@SGaist ok, I'll close it here! Thanks