PDA

View Full Version : Deploying Qt apps compiled with Visual C++ Express Edition



wmnnd
30th December 2009, 14:18
Hello everyone,

have have just found out that the Qt4 libs compiled with/for Visual C++ are way smaller than those for mingw.
So I thought, it would be a good idea, to use Visual C++ with Qt on Windows (only for deploying the app, Qt Creator is just too good and I'm on Linux most of the time anyway).

So my question is whether you do have to ship a certain runtime for apps compiled with Visual C++ or not?
With mingw, you only need to ship the mingw and gcc dlls but apparently there is a thing called "Visual C++ Redistributable". Is it necessary that this is installed for the application to work?

Thanks in advance

squidge
30th December 2009, 15:25
Well, yes. You have to ship the Visual C++ run time library, which is included in the Visual C++ redistributable.

On GCC, you have to ship the GCC runtime library, unless you statically link it.

The advantage of Visual C++ is that its more common and thus more likely to already be installed on the PC. It's even shipped with the OS, but of course you can't confirm that its the correct version until its too late, so you normally distribute your program and Visual C runtime seperately unless it commercial, in which case, you bundle both together on the CD.

Do note however, that there are incompatibilities between GCC and VC++. For example, compiler extensions (such as structure alignment and padding), different library files, etc, so it might not be as easy as doing your entire project under QtCreator and just recompiling under VC++ before deployment.

wmnnd
30th December 2009, 15:40
Mh, I think I'll stick with gcc in that case. As my programm is a downloadable application, it would be rather complicated to offer the Redistributable also or explain to the users why they have to install another programm.

franco.amato
30th December 2009, 16:31
Well, yes. You have to ship the Visual C++ run time library, which is included in the Visual C++ redistributable.

On GCC, you have to ship the GCC runtime library, unless you statically link it.

The advantage of Visual C++ is that its more common and thus more likely to already be installed on the PC. It's even shipped with the OS, but of course you can't confirm that its the correct version until its too late, so you normally distribute your program and Visual C runtime seperately unless it commercial, in which case, you bundle both together on the CD.

Do note however, that there are incompatibilities between GCC and VC++. For example, compiler extensions (such as structure alignment and padding), different library files, etc, so it might not be as easy as doing your entire project under QtCreator and just recompiling under VC++ before deployment.

Hi,
Which is the Visual C++ run time library that I have to ship with the application?

Best

squidge
30th December 2009, 16:42
Mh, I think I'll stick with gcc in that case. As my programm is a downloadable application, it would be rather complicated to offer the Redistributable also or explain to the users why they have to install another programm.Or you could use a installer program which automatically installs the appropriate files.


Hi,
Which is the Visual C++ run time library that I have to ship with the application?
That depends on the version of VC++ used to compile your application and what libraries it depends on. For this reason, you should use the Redistributable Package for the version of the compiler you used. This ensures everything works and that you fully comply with any licensing.

wmnnd
30th December 2009, 18:26
But why would I want to use MSVC++ if it's so much more complicated to deploy my apps then?
Does it have any benefits (except for binaries which are a little smaller)?

squidge
30th December 2009, 18:52
But why would I want to use MSVC++ if it's so much more complicated to deploy my apps then?
Does it have any benefits (except for binaries which are a little smaller)?

It's not more complicated if you write the entire app using it. It CAN get more complicated if you write your app in QtCreator and then port it across to MSVC++ for the final deployment, which is what you said in your first post.

If you don't want the hassles of using two different compilers, then stick with the one you prefer. I know I wouldn't want to do the entire app using QtCreator, then all the testing, and then port and re-test under MSVC++. I'd use one and stick with it.

franco.amato
30th December 2009, 19:59
Or you could use a installer program which automatically installs the appropriate files.

That depends on the version of VC++ used to compile your application and what libraries it depends on. For this reason, you should use the Redistributable Package for the version of the compiler you used. This ensures everything works and that you fully comply with any licensing.

Hi,
how can I use that package? I never used it.

Thanx in advance.

Best Regards

squidge
30th December 2009, 20:30
What package ?

faldzip
30th December 2009, 21:08
But why would I want to use MSVC++ if it's so much more complicated to deploy my apps then?
Does it have any benefits (except for binaries which are a little smaller)?
I think it is not more compilcated - you just have to ship different dlls than with MinGW. (something like mscrt90.dll or something)

john_god
30th December 2009, 22:43
But why would I want to use MSVC++ if it's so much more complicated to deploy my apps then?
Does it have any benefits (except for binaries which are a little smaller)?

Check this post (http://www.qtcentre.org/forum/f-installation-and-deployment-5/t-mingw-x-visual-studio-compiler-16042.html) and this link (http://qtcreator.blogspot.com/).
It seems that not only the size but better performance. Personally I use QtCreator, I prefer it better, and not being a professional, I prefer KISS (keep it simple stupid) and save myself the pain of installing MSCV and putting it to work. Besides I dont like the ideia of having to install the MS Redistributable Package


Hi,
how can I use that package? I never used it.
Just download it from Microsoft site and install it.

faldzip
31st December 2009, 09:31
I'm using QtCreator under Windows7 but without MinGW, so it uses Visual Studio toolchain, which I have installed on my system.
If you have Visual Studio installed then there is in path like this:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\redist\x86
are dirs with required dlls. CRT are base dlls (C RunTime).
Also you can have look here (http://msdn.microsoft.com/en-us/library/8kche8ah.aspx) which is a sub page of this (http://msdn.microsoft.com/en-us/library/zebw5zk9.aspx) page.
Also you can use Dependency Walker (http://dependencywalker.com/) to determine which of those dlls are used by your app.

franco.amato
31st December 2009, 14:35
What package ?

The Redistributable package

squidge
31st December 2009, 16:48
It's just download and run, literally. For Visual Studio 2008, you would download http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf whereas for VS2005, you would download http://www.microsoft.com/downloads/details.aspx?familyid=32bc1bee-a3f9-4c13-9c99-220b62a191ee, or just include the appropriate file with your download or cd and it'll install whatever is necessary.

akauppi
18th January 2011, 09:13
I noticed use of Visual Studio and Qt Creator are seen as either/or. It's not that way. Though Nokia/Qt recommends the Visual Studio add-ins approach, one can also just use the MSVC compiler and develop with Qt Creator. I do that. All works, debugging etc. Nice! :)