Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 缺少括号?哪里_C++_Arrays_Braces - Fatal编程技术网

C++ 缺少括号?哪里

C++ 缺少括号?哪里,c++,arrays,braces,C++,Arrays,Braces,我得到了一个关于“警告房间初始值设定项周围缺少括号”的错误,虽然我理解错误的含义,但我不理解为什么会这样说。代码如下: //经理 class mapManager { public: mapManager(); private: }; class room //how the map tiles will have attributes. { public: //public because room needs to be accessible fr

我得到了一个关于“警告房间初始值设定项周围缺少括号”的错误,虽然我理解错误的含义,但我不理解为什么会这样说。代码如下:

//经理

class mapManager
{
    public:
    mapManager();

    private:
};

class room //how the map tiles will have attributes.
{
    public:
    //public because room needs to be accessible from map manager
    int dir; //direction of the current tile
};
mapManager::mapManager()
{
    room map[4][8] = {
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8}
                    };
}

//manager.cpp 包括经理

mapManager::mapManager()
{
    room map[4][8] = {
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8},
                        {1, 2, 3, 4, 5, 6, 7, 8}
                    };
}

我没有看到任何缺少的牙套!帮忙

我刚刚意识到我只是假装一个类是一个整数。谢谢大家的评论。

什么是“房间”?它是如何定义的?gcc 4.6.1 typedefing room中的代码没有错误,可以将其定义为int。您可以共享您的编译器,并给出一些相关代码吗?我不认为您缺少任何大括号。它对我来说很好。是否确定已定义房间类型?房间类型是什么?当我用int替换它时,上面的代码是用gcc编译的,所以您可能应该看看房间是如何定义的。您能显示房间定义吗?