编译错求调悬关
查看原帖
编译错求调悬关
1036180
ChampionCyan楼主2024/5/28 18:18

打了一半,因此回复给出原因即可

编译错误提示:

/tmp/compiler_tn609wsw/src:75:14: 错误:使用了被删除的函数‘COM::COM()’
   75 | COM a[100][10];
      |              ^
/tmp/compiler_tn609wsw/src:70:8: 附注:‘COM::COM()’ is implicitly deleted because the default definition would be ill-formed:
   70 | struct COM {
      |        ^~~
/tmp/compiler_tn609wsw/src:70:8: 错误:使用了被删除的函数‘CON::CON()’
/tmp/compiler_tn609wsw/src:61:7: 附注:‘CON::CON()’ is implicitly deleted because the default definition would be ill-formed:
   61 | union CON {
      |       ^~~
/tmp/compiler_tn609wsw/src:67:9: 错误:union member ‘CON::tri’ with non-trivial ‘TRI::TRI()’
   67 |     TRI tri;
      |         ^~~
/tmp/compiler_tn609wsw/src:70:8: 错误:使用了被删除的函数‘CON::~CON()’
   70 | struct COM {
      |        ^~~
/tmp/compiler_tn609wsw/src:61:7: 附注:‘CON::~CON()’ is implicitly deleted because the default definition would be ill-formed:
   61 | union CON {
      |       ^~~
/tmp/compiler_tn609wsw/src:67:9: 错误:union member ‘CON::tri’ with non-trivial ‘TRI::~TRI()’
   67 |     TRI tri;
      |         ^~~
/tmp/compiler_tn609wsw/src:75:14: 错误:使用了被删除的函数‘COM::~COM()’
   75 | COM a[100][10];
      |              ^
/tmp/compiler_tn609wsw/src:70:8: 附注:‘COM::~COM()’ is implicitly deleted because the default definition would be ill-formed:
   70 | struct COM {
      |        ^~~
/tmp/compiler_tn609wsw/src:70:8: 错误:使用了被删除的函数‘CON::~CON()’
/tmp/compiler_tn609wsw/src:75:14: 错误:使用了被删除的函数‘COM::~COM()’
   75 | COM a[100][10];
      |              ^
/tmp/compiler_tn609wsw/src: 在函数‘bool is_equal(const COM&, const COM&)’中:
/tmp/compiler_tn609wsw/src:79:19: 错误:‘const struct COM’ has no member named ‘type’; did you mean ‘typ’?
   79 |         switch (a.type) {
      |                   ^~~~
      |                   typ
/tmp/compiler_tn609wsw/src:83:26: 错误:‘const struct COM’ has no member named ‘mov’
   83 |                 return a.mov.h == b.mov.h && a.mov.z == b.mov.z;
      |                          ^~~
/tmp/compiler_tn609wsw/src:83:37: 错误:‘const struct COM’ has no member named ‘mov’
   83 |                 return a.mov.h == b.mov.h && a.mov.z == b.mov.z;
      |                                     ^~~
/tmp/compiler_tn609wsw/src:83:48: 错误:‘const struct COM’ has no member named ‘mov’
   83 |                 return a.mov.h == b.mov.h && a.mov.z == b.mov.z;
      |                                                ^~~
/tmp/compiler_tn609wsw/src:83:59: 错误:‘const struct COM’ has no member named ‘mov’
   83 |                 return a.mov.h == b.mov.h && a.mov.z == b.mov.z;
      |                                                           ^~~
/tmp/compiler_tn609wsw/src:85:26: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                          ^~~
/tmp/compiler_tn609wsw/src:85:37: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                                     ^~~
/tmp/compiler_tn609wsw/src:85:48: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                                                ^~~
/tmp/compiler_tn609wsw/src:85:59: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                                                           ^~~
/tmp/compiler_tn609wsw/src:85:70: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                                                                      ^~~
/tmp/compiler_tn609wsw/src:85:81: 错误:‘const struct COM’ has no member named ‘swa’
   85 |                 return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
      |                                                                                 ^~~
/tmp/compiler_tn609wsw/src:87:26: 错误:‘const struct COM’ has no member named ‘mir’
   87 |                 return a.mir.h == b.mir.h && a.mir.x == b.mir.x;
      |                          ^~~
/tmp/compiler_tn609wsw/src:87:37: 错误:‘const struct COM’ has no member named ‘mir’
   87 |                 return a.mir.h == b.mir.h && a.mir.x == b.mir.x;
      |                                     ^~~
/tmp/compiler_tn609wsw/src:87:48: 错误:‘const struct COM’ has no member named ‘mir’
   87 |                 return a.mir.h == b.mir.h && a.mir.x == b.mir.x;
      |                                                ^~~
/tmp/compiler_tn609wsw/src:87:59: 错误:‘const struct COM’ has no member named ‘mir’
   87 |                 return a.mir.h == b.mir.h && a.mir.x == b.mir.x;
      |                                                           ^~~
/tmp/compiler_tn609wsw/src:89:26: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                          ^~~
/tmp/compiler_tn609wsw/src:89:37: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                                     ^~~
/tmp/compiler_tn609wsw/src:89:48: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                                                ^~~
/tmp/compiler_tn609wsw/src:89:59: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                                                           ^~~
/tmp/compiler_tn609wsw/src:89:81: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                                                                                 ^~~
/tmp/compiler_tn609wsw/src:89:95: 错误:‘const struct COM’ has no member named ‘rep’
   89 |                 return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
      |                                                                                               ^~~
/tmp/compiler_tn609wsw/src:91:26: 错误:‘const struct COM’ has no member named ‘act’
   91 |                 return a.act.h == b.act.h;
      |                          ^~~
/tmp/compiler_tn609wsw/src:91:37: 错误:‘const struct COM’ has no member named ‘act’
   91 |                 return a.act.h == b.act.h;
      |                                     ^~~
/tmp/compiler_tn609wsw/src:93:26: 错误:‘const struct COM’ has no member named ‘tri’
   93 |                 return a.tri.nam == b.tri.nam && is_equal(*(a.tri.com), *(b.tri.com));
      |                          ^~~
/tmp/compiler_tn609wsw/src:93:39: 错误:‘const struct COM’ has no member named ‘tri’
   93 |                 return a.tri.nam == b.tri.nam && is_equal(*(a.tri.com), *(b.tri.com));
      |                                       ^~~
/tmp/compiler_tn609wsw/src:93:63: 错误:‘const struct COM’ has no member named ‘tri’
   93 |                 return a.tri.nam == b.tri.nam && is_equal(*(a.tri.com), *(b.tri.com));
      |                                                               ^~~
/tmp/compiler_tn609wsw/src:93:77: 错误:‘const struct COM’ has no member named ‘tri’
   93 |                 return a.tri.nam == b.tri.nam && is_equal(*(a.tri.com), *(b.tri.com));
      |                                                                             ^~~
/tmp/compiler_tn609wsw/src: 在函数‘void __static_initialization_and_destruction_0(int, int)’中:
/tmp/compiler_tn609wsw/src:75:5: 错误:使用了被删除的函数‘COM::~COM()’
   75 | COM a[100][10];
      |     ^
/tmp/compiler_tn609wsw/src: 在函数‘void __tcf_0(void*)’中:
/tmp/compiler_tn609wsw/src:75:5: 错误:使用了被删除的函数‘COM::~COM()’

code:

#include <bits/stdc++.h>
using namespace std;
int n, m, k;

inline string read_string() {
    char ch = getchar();
    string s = "";
    while (ch >= 'A' && ch <= 'Z')
        s += ch, ch = getchar();
    return s;
}

inline int read_int() {
    int ret = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9')
        ch = getchar();
    while (ch >= '0' && ch <= '9')
        ret = (ret << 3) + (ret << 1) + ch - '0', ch = getchar();
    return ret;
}

inline void print_string(const string &s) {
    int string_length = s.length();
    for (int i = 0; i < string_length; i++)
        putchar(s[i]);
}

void print_int(int x) {
    if (x > 9)
        print_int(x / 10);
    putchar(x % 10 + '0');
}

struct MOV {
    int h, z; 
};

struct SWA {
    int h, x, y;
};

struct MIR {
    int h, x;
};

struct REP {
    struct COM *com;
    int h, x;
};

struct ACT {
    int h;
};

struct TRI {
    struct COM *com;
    string nam;
};

union CON {
    MOV mov;
    SWA swa;
    MIR mir;
    REP rep;
    ACT act;
    TRI tri;
};

struct COM {
   char typ;
   CON con;
};

COM a[100][10];

bool is_equal (const COM &a, const COM &b) {
    if (a.typ == b.typ)
        switch (a.type) {
            case 'n':
                return true;
            case 'm':
                return a.mov.h == b.mov.h && a.mov.z == b.mov.z;
            case 's':
                return a.swa.h == b.swa.h && a.swa.x == b.swa.x && a.swa.y == b.swa.y;
            case 'i':
                return a.mir.h == b.mir.h && a.mir.x == b.mir.x;
            case 'r':
                return a.rep.h == b.rep.h && a.rep.x == b.rep.x && is_equal(*(a.rep.com), *(b.rep.com));
            case 'a':
                return a.act.h == b.act.h;
            case 't':
                return a.tri.nam == b.tri.nam && is_equal(*(a.tri.com), *(b.tri.com));
        }
    return false;
}

int main() {
    n = read_int(), m = read_int(), k = read_int();
    /*for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            get_commend(i, j);
    */
    return 0;
}
2024/5/28 18:18
加载中...