Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt_add_qml_module not working for windows, when linked into an app
Qt 6.11 is out! See what's new in the release blog

qt_add_qml_module not working for windows, when linked into an app

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #1

    Hey, I am running into a problem with

    qt_add_qml_module
    

    on 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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #9

      Since it's about the same subject, it would be better to continue over there since the outcome looks good.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        C 1 Reply Last reply
        0
        • SGaistS SGaist

          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.

          C Offline
          C Offline
          Creaperdown
          wrote on last edited by
          #3

          @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

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            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.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            C 1 Reply Last reply
            0
            • SGaistS SGaist

              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.

              C Offline
              C Offline
              Creaperdown
              wrote on last edited by
              #5

              @SGaist Oh, my bad. I didnt push the changes. They should be visible now

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Creaperdown
                wrote on last edited by
                #6

                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

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  Isn't that the same issue as this thread ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  C 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Isn't that the same issue as this thread ?

                    C Offline
                    C Offline
                    Creaperdown
                    wrote on last edited by
                    #8

                    @SGaist, we figured out that the other threads problem has the same cause as this. Am I supposed to close this one?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      Since it's about the same subject, it would be better to continue over there since the outcome looks good.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      C 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Since it's about the same subject, it would be better to continue over there since the outcome looks good.

                        C Offline
                        C Offline
                        Creaperdown
                        wrote on last edited by
                        #10

                        @SGaist ok, I'll close it here! Thanks

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved