记录详情

Compile Error

/in/foo.cc:11:3: error: conflicting declaration 'typedef struct Edge Edge'
 } Edge;
   ^~~~
/in/foo.cc:10:12: note: previous declaration as 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc: In function 'void add_edge(int, int, int)':
/in/foo.cc:22:47: error: invalid application of 'sizeof' to incomplete type 'Edge'
     Edge* new_edge = (Edge*)malloc(sizeof(Edge));
                                               ^
/in/foo.cc:23:13: error: invalid use of incomplete type 'struct Edge'
     new_edge->to = v;
             ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc:24:13: error: invalid use of incomplete type 'struct Edge'
     new_edge->length = d;
             ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc:25:13: error: invalid use of incomplete type 'struct Edge'
     new_edge->next = graph[u].head;
             ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc: In function 'void dijkstra(int, int)':
/in/foo.cc:49:67: error: invalid use of incomplete type 'struct Edge'
         for (Edge* edge = graph[u].head; edge != NULL; edge = edge->next) {
                                                                   ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc:50:25: error: invalid use of incomplete type 'struct Edge'
             int v = edge->to;
                         ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~
/in/foo.cc:51:30: error: invalid use of incomplete type 'struct Edge'
             int length = edge->length;
                              ^~
/in/foo.cc:10:12: note: forward declaration of 'struct Edge'
     struct Edge* next;
            ^~~~

信息

递交者
类型
自测
语言
C++
递交时间
2024-11-16 15:41:30
评测时间
2024-11-16 15:41:30
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes