I have written a shared library in C++ using qt creator and QMake
When I compile my project with MinGW compiler, I need the libraries libgcc_s_dw2-1.dll
, libstdc++-6.dll
and libwinpthread-1.dll
to be copied next to my DLL in order to work. Which has about 1.5 megabytes size.
When I compile my project with MSVC 2015 compiler, I need to install the Visual C++ Redistributable 2015 x86
on the deployment system. Which has about 13 megabytes size.
My project has less than 100 kiloobytes size so these dependencies are so big.
How can I embed them into my library? or How can I have fewer dependencies to be installed or copied next to my project in Windows 7 or upper?
PS 1: I have read this , but the MinGW method was the same as before. And I encountered errors in Microsoft Tools method.
PS 2: Maybe .Net Framework 2.0 is a better option because it is preinstalled on Windows 7 and we can force .Net 4.5 to run it in Windows 8/8.1/10. Don't you agee?
我认为您无法做到这一点,您的项目必须设置在静态或动态链接上,而不是将两者都设置在一起。
Just link standard libraries statically. Your DLL size will increase obviously (I hope it isn't a problem) but not that much (<1 MB).
To do that:
If you use MSVC add /MT to command line (you can find it in project properties window too).
If you use g++ add '--static' .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.