PDA

View Full Version : attach libraries to exe



szisziszilvi
20th April 2011, 13:54
Hi,

my purpose is making my Qt app useable on other computers that have never seen Qt. There are some ways discussed here: http://www.qtcentre.org/wiki/index.php?title=Deploying_Qt_Applications

The static linking would be ok as it is not a big application, but that is unfortunatelly not for free, so I have to drop that idea.

I can find and copy the nessesary dll-s (like QtCore4.dll ect), but there are still some needs. My application keeps searching for the .dll-s and .a-s that can be found here: c:\Qt\2010.05\qt\plugins\imageformats\
And these files must be here, not anywhere else. Not in the folder of the executable, not in anything similar, exactly here. Which means also that if I have a previos Qt version installed that has everything let's say in c:\Qt\2009.05\... then my application works fine only if I rename that folder or if I copy the needed files into a properly named path, but than I'll have this structure:
c:\Qt\2009.05\... (here everyting, this is the already installed qt)
c:\Qt\2010.05\... (only necessary path and files)

There would also be a way to make a proper installer which would create this c:\Qt\2010.05\qt\plugins\imageformats\ if it is not already given on the system, but it would be a better solution to make my application portable.

So my question is:
- is there a way to declare for the application a new location some specific libraries?
- I'm on to learn this suggested NSIS, I guess there would be a way to define more than one installation folder. Or am I on a wrong way?

Szilvi

squidge
20th April 2011, 14:28
Static linking can be used for free software (and even closed source), check the license for the particulars.

You should be able to just put the default libraries into the same folder as your executable and put imageformats in a directory off the executable (eg. "plugins\imageformats")

szisziszilvi
20th April 2011, 15:23
thanks for the hint I think it was a "lost in the forest" case.
I started to "reduce" the length of the path and the last one worked fine. I tried this before but I stopped one level upper, because I beleived hard somhow that the plugin folder should remain, but no, the solution is to have this file structure:
myappfolder\
-----myapp.exe
-----QtCore4.dll
-----QtGui4.dll
-----libgcc_s_dw2-1.dll
-----mingwm10.dll
-----imageformats\
----------------------(whole content of c:\Qt\2010.05\qt\plugins\imageformats\ is copied)

thanks again, sometimes saying "you should keep on trying that with some details changed" is the best help one can give. :)