Results 1 to 6 of 6

Thread: Which runtime libs are allowed by Qt? (vc++7.1)

  1. #1
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    4
    Thanked 6 Times in 5 Posts

    Question 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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default 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).

  3. The following user says thank you to wysota for this useful post:

    gri (28th September 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default 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 ?
    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.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    gri (28th September 2007)

  6. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Which runtime libs are allowed by Qt? (vc++7.1)

    Yes, that's probably where I read that

  7. #5
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    55
    Thanked 12 Times in 11 Posts

    Default 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.
    Software Engineer



  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.