May 15, 2012

Golum256 Golum256
Lab Rat
2 posts

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

 

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?

2 replies

May 15, 2012

MuldeR MuldeR
Robot Herder
474 posts

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.

 Signature 

My OpenSource/Libre software at: http://muldersoft.com/ | Go visit the coop: http://youtu.be/Jay-fG9eaYk

May 16, 2012

Golum256 Golum256
Lab Rat
2 posts

Thank you very much!! Worked awesome !!

 
  ‹‹ QtGuid4 was not found?      QSslSocket ››

You must log in to post a reply. Not a member yet? Register here!