Only static constant data integral member can be initialized within a class
-
I get this error, when i build a code in Windows 8 Qt 4.8.3 when i try to run this
@
QGraphicsScene* ManualRegistrationScene_=new QGraphicsScene();
QGraphicsPixmapItem* StationaryImage_=new QGraphicsPixmapItem();
QGraphicsPixmapItem* MovingImage_=new QGraphicsPixmapItem();
QGraphicsPixmapItem* DifferenceImage_=new QGraphicsPixmapItem();
@
I had done the same code in Mac. But it works perfectly. I built the Qt from source using VS 2012 64 bit. Is there any way to get rid of this error by the same initialization? Would be great to have some guidance -
Hi,
Are you instantiating variables in your class declaration ?
Can you show your header ?
-
Hi,
Thanks for replying. I have herewith attached my header
@
#ifndef OVERLAYVIEW_H
#define OVERLAYVIEW_H//Qt Headers
#include<QGraphicsView>
#include<QGraphicsPixmapItem>
//Itk Headers
/*#include"ITK/itkImageFileReader.h"
#include"ITK/itkResampleImageFilter.h"
#include"ITK/itkImage.h"
#include"ITK/itkImageToVTKImageFilter.h"
#include"ITK/itkSubtractImageFilter.h"//vtk headers
#include"VTK/vtkQImageToImageSource.h"
#include"VTK/vtkImageToImageFilter.h"*/class OverlayView:public QGraphicsView
{
Q_OBJECT
public:
explicit OverlayView(QWidget *parent=0);
void OpacityImage();
// void DifferenceImage();
void TransformMatrix();private:
QGraphicsScene* ManualRegistrationScene=new QGraphicsScene();
QGraphicsPixmapItem* StationaryImage_=new QGraphicsPixmapItem();
QGraphicsPixmapItem* MovingImage_=new QGraphicsPixmapItem();
// QGraphicsPixmapItem* DifferenceImage_;
QTransform Transform_;
QTransform ZoomAndRotateTransform_;public slots:
void setOpacityImage(QGraphicsPixmapItem *StationaryImage,QGraphicsPixmapItem *MovingImage);
// void setDifferenceImage(QGraphicsPixmapItem *DifferenceImage,QGraphicsPixmapItem *DifferenceMovingImage);
void setTransform(QTransform Transform);
void setZoomAndRotate(QTransform ZoomAndRotateTransform);signals:
void TransformsChanged(QTransform TransformMatrix);
};#endif // OVERLAYVIEW_H
@ -
Indeed that's wrong,
You can't do that, I'm surprised it works on OS X but anyway, initialize your member variables in the constructor.