Qt World Summit: Register Today!

Error 3668 when building QT Application against QT 5.11 with Visual Studio 2015

  • I have a bit of an odd situation happening. I've built QT on Windows under VS2015. The problem comes when I try to build my application against my QT install. For some odd reason I'm getting an error in the header files of the QT install:

    c:\path\to\qt\install\include\QtCore/qfiledevice.h(103): error C3668: 'QFileDevice::_close': method with override specifier 'override' did not override any base class method

    I looked around a bit and and in particular I looked at the pre-proccessor output. It seems that the VS2015 pre-processor is changing

    virtual void close() override;


    virtual void _close() override;

    in the QFileDevice class definition from qfiledevice.h. Technically I guess that explains the 3668 error, since there is no _close() in the QIODevice class, just virtual void close();

    So what I'm wondering is, has anyone seen behavior like this where the pre-processor just decides to change a method name in a header for seemingly no reason, or even better, just run in to this error when using QT 5.11 with Visual Studio 2015?

    If it helps I built my QT install with -static and -static-runtime, not sure why that would make a difference in this case though. It's also probably worth noting I'm normally launching this build with a call to nmake against a qmake generated Makefile.

    Any help on this would be greatly appreciated.

  • Lifetime Qt Champion

    You somehwere have a define which changes 'close' to '_close' - fix it.

  • I'm going to just chalk this up to sleep deprivation. You hit the nail on the head, one of our headers was causing the damage. Thanks for the help.

  • Lifetime Qt Champion

    @vaultnerd Then please mark this topic as solved, thx.