小编Mic*_*ęgi的帖子

为什么gcc编译这个而msvc没有

这是我的课

class ContainerStack{
public:
    int getCapacity();
    int getSize();
    const Container& at(int height);
    void take(Container aContainer);
    Container give();

private:
    std::vector<Container> containers();
};
Run Code Online (Sandbox Code Playgroud)

这是getCapacity()和getSize()方法

int ContainerStack::getCapacity(){
    return containers.capacity();
}

int ContainerStack::getSize(){
    return containers.size();
}
Run Code Online (Sandbox Code Playgroud)

GCC编译所有内容没有问题,但在使用Visual Studio 2017时,我得到一个E0153表达式必须有类类型错误.有任何解决这个问题的方法吗?

c++ gcc compiler-errors compilation visual-studio

-1
推荐指数
1
解决办法
56
查看次数

标签 统计

c++ ×1

compilation ×1

compiler-errors ×1

gcc ×1

visual-studio ×1