在nearPoint之前预期的初始化程序

时间:2016-03-07 09:14:45

标签: c++

这一行可能出现什么错误?

const SPoint nearPoints[iloscKierunkow] = {SPoint(0, -1), SPoint(1, 0), SPoint(0, 1), SPoint(-1, 0)};

我得到了

  

错误预期在nearPoint之前的初始化程序

索引代码是

static const int TU_JESTEM = '+';
static const int NIE_BADANY = ' ';
static const int ZBADANY = '*';

const int iloscKierunkow = 4;
const int SPoint nearPoints[iloscKierunkow] = {SPoint(0, -1), SPoint(1, 0), SPoint(0, 1), SPoint(-1, 0)};

class Punkt
{
public:
    int x, y;

    Punkt(int Nx = 0, int Ny = 0)
    {//konstruktor
        x = Nx;
        y = Ny;

2 个答案:

答案 0 :(得分:1)

const int SPoint nearPoints[iloscKierunkow] = {SPoint(0, -1), SPoint(1, 0), SPoint(0, 1), SPoint(-1, 0)};

将其类型声明为int,然后声明SPoint。我猜你的意思是:

const SPoint nearPoints[iloscKierunkow] = {SPoint(0, -1), SPoint(1, 0), SPoint(0, 1), SPoint(-1, 0)};

答案 1 :(得分:0)

看看它:

server {
    listen       80;
    server_name  localhost;
    root         /var/www/nginx-default/myapp/public;

    #...
}

'int'在这里是不必要的