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. Problem with 2 different libraries each having it's own rcc file.
Forum Updated to NodeBB v4.3 + New Features

Problem with 2 different libraries each having it's own rcc file.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 4.2k Views 1 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.
  • G Offline
    G Offline
    Golum256
    wrote on last edited by
    #1

    When I link in 2 different libraries ( which each have a QT resource ) I get the following link errors, names have been changed to protect the innocent....

    A.lib(Doit.obj) : error LNK2005: "int cdecl qInitResources(void)" (?qInitResources@@YAHXZ) already defined in B.lib(Foo.obj)
    A.lib(Doit.obj) : error LNK2005: "int cdecl qCleanupResources(void)" (?qCleanupResources@@YAHXZ) already defined in B.lib(Foo.obj)
    A.lib(Doit.obj) : error LNK2005: "class qCleanupResources__dest_class
    qCleanupResources__dest_instance
    " (?qCleanupResources__dest_instance__@@3VqCleanupResources__dest_class__@@A) already defined in B.lib(Foo.obj)

    The resources include only art and are compiled from a QRC file, example below...

    <RCC>
    <qresource "/myresources">
    <file>images/picture.png</file>
    </qresource>
    </RCC>

    Looking at the rcc file I see that both have the lines
    int QT_MANGLE_NAMESPACE(qInitResources)() {...}
    int QT_MANGLE_NAMESPACE(qCleanupResources)() {...}

    I am building in VS2005 on Windows XP.

    Does any one know how I can resolve this?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MuldeR
      wrote on last edited by
      #2

      If you want to link in several resource files compiled with the Qt RCC into the same binary, use the "-name" parameter. And pass a different/unique value to "-name" for each invocation of RCC. This will change the name of the "qInitResources" and "qCleanupResources" functions in the generated code to avoid name conflicts.

      My OpenSource software at: http://muldersoft.com/

      Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

      Go visit the coop: http://youtu.be/Jay...

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Golum256
        wrote on last edited by
        #3

        Thank you very much!! Worked awesome !!

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IBM1401
          wrote on last edited by
          #4

          I have same issue when I tried to switch from qt 6.6.3 to 6.8.0.
          How to fix in cmake?

          from my cmake:

          qt_add_translations(${PROJECT_NAME}
          INCLUDE_DIRECTORIES
          ${PROJECT_SOURCE_DIR}
          TS_FILES
          ${TS_PROJECT_FILES})

          O 1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            I don't see what translations should have to do with a duplicate symbol... and this thread was about qmake and not cmake.
            Please open a new thread with a valid error description.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • I IBM1401

              I have same issue when I tried to switch from qt 6.6.3 to 6.8.0.
              How to fix in cmake?

              from my cmake:

              qt_add_translations(${PROJECT_NAME}
              INCLUDE_DIRECTORIES
              ${PROJECT_SOURCE_DIR}
              TS_FILES
              ${TS_PROJECT_FILES})

              O Offline
              O Offline
              odelaune
              wrote on last edited by odelaune
              #6

              @IBM1401 Your problem is a bug in Qt 6.8.0 (or CMake).

              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