3

This is a sort of follow-up to this question I posted yesterday. My problem regards which runtime C++ libraries to link against. I am using Qt as a framework and QtCreator for my IDE. According to the digia docs here, Qt has been known to have memory problems when built with the /MT flag (which makes your app run against the static runtime libraries). However, I'm also using a 3rd party driver in this app, and the docs on that app specifically say that it won't build unless you link against the static runtime libraries. Sure enough, it compiles fine with the /MT flag, but gives me about 40 linker errors when I remove that setting. (and so far I'm only including one header file from the driver's static library)

So my question is: what's the correct thing to do here? Is there a way to force the driver to expect the dynamic runtime library? Or should I live with Qt's memory management problem? Or is there a way to have Qt link against the dynamic ones and the driver (and the parts of Boost that it requires) link against the static ones? (and keep in mind that I'm doing this in QtCreator, not studio)

4

1 回答 1

1

/MT和都是/MD链接器选项。如果您正在构建多个模块,则可以有多个选项。

在这种情况下,请使用/MDQt 和您自己的代码。将驱动程序包装在其自己的 DLL 中,使用不依赖于 CRT 的 API,并将该 DLL 与/MT. 使用 COM 可能是一种选择。这当然不依赖于 CRT,但它可能是矫枉过正的。

于 2013-02-28T12:07:22.103 回答