Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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,
    Sachin



  • I have implemented a sample code for this.

    header file "srasterpaintengine.h" looks like this.

    @#ifndef SRASTERPAINTENGINE_H
    #define SRASTERPAINTENGINE_H

    #include <private/qpaintengine_raster_p.h>

    class SRasterPaintEngine : public QObject

    {

    public:
    SRasterPaintEngine( QPaintDevice *device );
    ~SRasterPaintEngine();

    private:
    QRasterPaintEngine *raster_engine;

    };

    #endif // SRASTERPAINTENGINE_H
    @

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

    @#include "srasterpaintengine.h"

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

    SRasterPaintEngine::~SRasterPaintEngine()
    {
    if(raster_engine)
    delete raster_engine;
    }
    @

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

    Thanks,
    Sachin


  • Lifetime Qt Champion

    Hi,

    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.

    Thanks,
    Sachin


  • 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