Which runtime libs are allowed by Qt? (vc++7.1)
Hello,
the last days I played around with my linker settings and my Qt designer crashes when I compile Qt with "/MT" (Multithreaded Static Runtime). Since QTextCodec::makeDecoder() new's a QTextDecoder which gets deleted in QXmlInputSource::~QXmlInputSource(). This is not allowed when not using "/MD" (which is Qt's default). When using "/MD" the new and delete operators are together in the msvcrt71.dll, which allows the delete of objects which have been new'ed in other dlls.
So am I only allowed to link with "/MT" when I'm building static, otherwise only "/MD"?
Am I too stupid to find this in the docs? :P
Thanks,
gri
Re: Which runtime libs are allowed by Qt? (vc++7.1)
The docs say you shouldn't use /MT with Qt. Don't ask me where it says so, I don't remember, probably in the chapter about deploying on Windows, but maybe it was completely elsewhere. On the other hand I managed to use /MT successfully, but it was indeed while building in static mode (and of course Qt itself was built with /MT as well).
Re: Which runtime libs are allowed by Qt? (vc++7.1)
Trolltech Knowledgebase: Why does a statically built Qt use the dynamic Visual Studio runtime libraries ? Do I need to deploy those with my application ?
Quote:
Qt is built using the -MD(d) switch, which links against the dynamic C/C++ runtime libraries. This is necessary as we have experienced memory problems when using anything but the -MD(d) flag, and in general, it is recommended to use. You should not alter this flag yourself for your application, because it conflicts with how the Qt library is built if you change the flag to -MT. You should not change it for Qt either, since it is likely to cause problems.
Re: Which runtime libs are allowed by Qt? (vc++7.1)
Yes, that's probably where I read that :)
Re: Which runtime libs are allowed by Qt? (vc++7.1)
Yeah, the compile option you use for your application must match the option you used for compiling Qt. I have had some success statically linking the CRT to my app with Qt, but my app was rather small. YMMV - I'm not surprised something like QtDesigner would crash, as it is much more complex, loading dll's dynamically left and right.
Re: Which runtime libs are allowed by Qt? (vc++7.1)
There is no point in linking Qt Designer statically with the runtime, at least not in a usual case, because Designer is usually deployed with a complete Qt installation and due to the amount of tools linking to the libraries, a static deployment would waste huge amounts of diskspace. So unless you are deploying Designer and only Designer, you won't want to link statically.