2013-04-27 50 views
-1

我在下面的代碼中看到'圖'的衝突類型錯誤,但我不確定問題是什麼,因爲Graph在任何地方使用前都被聲明。任何人都知道問題是什麼?'Graph'錯誤的衝突類型

#include <stdlib.h> 
#include <stdio.h> 
#include <ctype.h> 
#define __USE_BSD // make prototype for strdup visible 
#include <string.h> 

typedef struct linkedlist { // linked list of ints (for use in Node) 
    int index; 
    struct linkedlist *next; 
} List; 

typedef struct { // a Node of a Graph 
    char *name; 
    List *outlist; // adjacency list 
    int outdegree; // length of outlist 
    int indegree; // length of inlist 
    int dfsnum; 
    //double pagerank_score; //not needed for this exercise 
} Node; 

typedef struct { 
    int MaxSize; 
    Node *table; 
} Graph; 

// use to check result of strdup, malloc etc. 
extern void check (void *memory, char *message); 

extern int initialize_graph (Graph *mygraph, int MaxSize); 
extern int insert_graph_node (Graph *mygraph, int n, char *name); 
extern int insert_graph_link (Graph *mygraph, int source, int target); 
extern int read_graph (Graph *mygraph, char *filename); 
extern void print_graph (Graph *mygraph); 
+0

你的編譯器告訴你類似「以前的定義是在這裏:...」嗎? – 2013-04-27 12:41:49

+0

@DanielFischer是它說'圖'的先前的定義是在線24 – user1899174 2013-04-27 12:44:28

+0

這不會產生任何錯誤對我來說。這是你的整個代碼嗎? – 2013-04-27 12:45:08

回答

0

我不知道,但我認爲CDT MinGW的有已經有保留的變量名被稱爲「圖形」的擴展C lib中,你嘗試過重命名你的結構?這可能是這種情況,雖然我從來沒有與CDT MinGW合作過