在C ++ 98中初始化Matrix的正确方法是什么?

时间:2009-12-02 14:48:42

标签: c++ mingw c++98

  1. 我不是程序员
  2. 我想在win32中编译Inkscape,并偶然发现了这些错误消息:
  3.   

    ui / dialog / filedialogimpl-win32.cpp:1379:错误:在C ++ 98中'矩阵'必须由构造函数初始化,而不是由'{...}'初始化   make [1]:*** [ui / dialog / filedialogimpl-win32.o]错误1

    可疑的filedialogimpl-win32.cpp代码:

    ...
        // Draw the image
        if(_preview_bitmap_image)    // Is the image a pixbuf?
        {
            // Set the transformation
            const Matrix matrix = {
                scaleFactor, 0,
                0, scaleFactor,
                svgX, svgY };
            context->set_matrix (matrix);
    ...
    

    那么它是如何用C ++ 98标准编写的?

    我在Google上搜索,但没有人遇到过这种情况,是不是无关?

1 个答案:

答案 0 :(得分:4)

而不是

const Matrix matrix = { scaleFactor, 0, 0, scaleFactor, svgX, svgY };

应该是这样的:

const Matrix matrix( scaleFactor, 0, 0, scaleFactor, svgX, svgY );