[CMake] Call to QTextStream(stdin) crashes the program built by CMake and Visual Studio

John Drescher drescherjm at gmail.com
Wed Nov 23 09:59:31 EST 2011


On Wed, Nov 23, 2011 at 8:53 AM, Yegor Derevenets
<yegor.derevenets at gmail.com> wrote:
> Hi All,
>
> The following Qt program crashes with access violation when being built
> on Windows by Microsoft Visual Studio 2010 using cmake 2.8.6 and doesn't
> crash when being built using qmake:
>
> #include <cstdio>
> #include <QTextStream>
>
> int main(int argc, char *argv[]) {
>    QTextStream qin(stdin, QIODevice::ReadOnly);
>
>    return 0;
> }
>
> Expected behaviour would be that the program wouldn't crash in both cases.
>
> The example and generated configuration files are available in the archive:
> http://yegor.f1recat.com/cmake_vs_qmake.7z
>
> The Qt version used is 4.7.4. Arguments to configure were:
> -release -shared -no-webkit -nomake examples -nomake demos
>
> The problem seems to be remotely similar to this one (although in my case
> nobody must be trying to do static linking):
> https://bugreports.qt.nokia.com//browse/QTBUG-9272
>
> Any ideas on what to look at next?
>
Is there some other version of Qt installed on your system? Are you
running release mode for your application? Remember debug mode for
your application can will crash since you did not create a debug build
of Qt and Microsoft debug and release configurations are not
compatible.

John


More information about the CMake mailing list