[Solved] Using foreign library in static build
-
My problem is my static build of my program chrashes with foreign DLL.
I can use it without any problems when I start the program from Qt Creator, but I want to use the program without Qt, like a standalone exe with some DLL's if needed.
I read somewhere that I need a static build, so I downloaded Qt and built it statically myself, just as a tutorial said.
The tutorial: "http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW":http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGWI use win8.1 and Qt 5.2.1 with MinGW
When I build the program statically there are now warnings or errors, everything goes smooth.
Although I built it statically the program still requires some Qt DLL files like:- icudt51, icuin51, icuuc51
- libgcc_s_dw2-1
- libstdc++-6
- libwinpthread-1
- Qt5Code, Qt5Gui, Qt5Widgets
- and the foreign library DLL's I downloaded of course
After building the program statically, and I start the exe I get errors of these DLL's missing so I copy them to one directory.
After all the DLL's are in one dir with the exe, the program finally starts, and works just as intended.
The problem is, when others run my program on their computer.
!http://www.wiliam.com.au/content/upload/blog/worksonmymachine.jpg(Works on my machine)!
When they start the exe my program starts and works indeed UNTIL the program needs to use the foreign DLL's. Then the program chrashes (windows message program has stopped working or something)My questions are:
- Is there a way to statically build my program without needing like 10 Qt DLL's?
- How do I use foreign DLL in my static program?
Please don't say something like "you need to build those foreign DLL's yourself" (couldn't make it, even with tutorials) but then how come it works on my computer
or "there is already a topic about this" because I searched for it and what I found didn't help at all.Thanks in advance!
-
Hi,
Did you check if these dll's had any dependencies ? You can use Dependency Walker for that.
-
Hi SGaist!
I tried Dependency Walker
No error or warning messages when loading DLL
!https://i.imgur.com/e1joUqm.png(My DLL)!I'm pretty sure this is the DLL that chrashes my program.
As far as I can tell from the image everything seems to be fine.
Any other ideas? -
I'd say MinGW vs Visual Studio clash
-
[quote author="SGaist" date="1416698014"]I'd say MinGW vs Visual Studio clash[/quote]
I tested it on another machine which has Qt with MSVC and works as intended. It seems it only works on a machine with Qt installed.
What can be the problem? Is it some DLL in the windows folder? Some registry entry? Some Qt system variable? -
Taking deployment considerations outside, it's more a problem of using a library built for Visual Studio with a Qt built with MinGW.
-
[quote author="SGaist" date="1416699642"]Taking deployment considerations outside, it's more a problem of using a library built for Visual Studio with a Qt built with MinGW. [/quote]
This was it. I -stole- borrowed the DLL I needed from another MinGW project and now it works just as intended on other computers as well, although I'm not using the static build, so I have like 50 MB of DLL's but the point is it works.
Thank you SGaist!