小编Dav*_* Oh的帖子

使用 GCC 编译时 C++ 中的未知结构错误

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int Answer;
struct _pair {
    struct _pair(int a) : value(a), cnt(1) {}
    unsigned int value;
    unsigned int cnt;
    };


int main(int argc, char** argv)
{

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

此代码出现错误:“错误:在 'int' struct _pair(int a) : value(a), cnt(1) {} 之前预期不合格 id”

在VS2017上没有报错,但是在GCC编译器上就报错了。

c++ gcc constructor struct g++

0
推荐指数
1
解决办法
80
查看次数

标签 统计

c++ ×1

constructor ×1

g++ ×1

gcc ×1

struct ×1