Incomprehensible compilation error for Gdiplus::Matrix() constructor

Joseph M. Newcomer 21 Reputation points
2023-10-01T17:41:58.1866667+00:00

From the documentation

Syntax

C++

void Matrix();

From gdiplusmatrix.h:

 Matrix()
    {
        GpMatrix *matrix = NULL;

        lastResult = DllExports::GdipCreateMatrix(&matrix);
    
        SetNativeMatrix(matrix);
    }

From my source code

Gdiplus::Matrix * matrix = new Gdiplus::Matrix();

From the compilation

1>C:\Users\admin\OneDrive\Projects\Patterns\Pattern1\Patterns1\Patterns1Dlg.cpp(370,56): error C2660: 'Gdiplus::GdiplusBase::operator new': function does not take 3 arguments

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\GdiplusBase.h(30,12): message : see declaration of 'Gdiplus::GdiplusBase::operator new'

The first error message refers to my use of new Gdiplus::Matrix().

The second error refers to the line

 void* (operator new)(size_t in_size)
    {
       return DllExports::GdipAlloc(in_size);
    }

So, why is this failing and how do I fix it?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,636 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 114.7K Reputation points
    2023-10-01T17:59:04.4466667+00:00

    It seems that you are using MFC. If GDI+ is needed, then try this:

    Gdiplus::Matrix* matrix = ::new Gdiplus::Matrix( );
    . . .
    ::delete matrix;
    
    // or:
    
    Gdiplus::Matrix matrix;
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful