Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to use CComPtr CComQIPtr



  • i wan't use CComPtr CComQIPtr, include atlbase.h
    But there are mistakes

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atldef.h:665: error: expected constructor, destructor, or type conversion before '(' token
    #define ATLPREFAST_SUPPRESS(x) __pragma(warning(push)) __pragma(warning(disable: x))
    ^

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atldef.h:666: error: expected constructor, destructor, or type conversion before '(' token
    #define ATLPREFAST_UNSUPPRESS() __pragma(warning(pop))
    ^

    C:\Qt\Qt5.11.1\Tools\mingw530_32\i686-w64-mingw32\include\mbstring.h:11: error: expected '}' before end of line

    C:\Qt\Qt5.11.1\Tools\mingw530_32\i686-w64-mingw32\include\mbstring.h:11: error: expected declaration before end of line



  • Hi, that particular error is easy to get rid of:

    // add this empty #define line before #including atlbase.h
    #define __pragma(x)
    #include "atlbase.h"
    

    Problem is that you're fighting an uphill battle by using MinGW for Microsoft specific stuff, you'll run into lots of other compiler errors, for example when I tried I got "#error Unsupported architecture"



  • Too much trouble. I don't need intelligent CComPtr and ComQIPtr. I'd better manage the pointer by hand.

    Thank you all the same.


Log in to reply