Important: Please read the Qt Code of Conduct -

Undefined reference to 'QRasterPaintEngine::QRasterPaintEngine(QPaintDevice*)'

  • Hello All,

    I am trying to use the QRasterPaintEngine to do painting operations for my project on "Qt for Embedded Linux", and getting a linking error to QRasterPaintEngine implementation.

    Initially, I got the error " QRasterPaintEngine : No such file or error ", So I changed the include path to absolute path to the header files, like below

    #include "/mydir/qt-everywhere-opensource-src-4.8.5/include/QtGui/private/qpaintengine_raster_p.h"

    So, the compilation is working fine, but while linking it is giving the error as,

    " undefined reference to 'QRasterPaintEngine::QRasterPaintEngine(QPaintDevice*)' ".

    Please suggest me how to resolve the linking error.

    Thanks in advance,

  • I have implemented a sample code for this.

    header file "srasterpaintengine.h" looks like this.


    #include <private/qpaintengine_raster_p.h>

    class SRasterPaintEngine : public QObject


    SRasterPaintEngine( QPaintDevice *device );

    QRasterPaintEngine *raster_engine;



    and the source file "srasterpaintengine.cpp" looks like below.

    @#include "srasterpaintengine.h"

    SRasterPaintEngine::SRasterPaintEngine(QPaintDevice *device):raster_engine(0)
    raster_engine = new QRasterPaintEngine(device);

    delete raster_engine;

    So, when I compiled this code, I am getting the linking error.
    Please suggest how to get it working.


  • Lifetime Qt Champion


    You know that you are trying to use private API's that are officially not to be used ?

    That said, what do you need to paint that would require modification to the raster paint engine ?

  • Hi,

    Thanks for replying,

    I am trying to hook my own GPU into the "Qt for Embedded Linux" and implement the few set of graphics operations.

    Yes, I know I am using the private APIs, I am working on POCs for this.
    Please suggest, if there are any other ways to do it.


  • Lifetime Qt Champion

    In that case, you should rather integrate your code directly in Qt, that would allow you to use the private APIs directly

Log in to reply