【问题标题】:error compiling c code after updating mingw更新mingw后编译c代码出错
【发布时间】:2011-01-24 09:46:30
【问题描述】:

大家好,今天我在win64环境下更新了mingw 但是现在我在编译时遇到错误,在更新之前编译器没有通知我..

这是错误:

a.h:9:39: error: expected ')' before '*' token
a.h:10:40: error: expected ')' before '*' token
a.h:11:34: error: expected ')' before '*' token

在这个外部 a.h 文件中:

...
9:  extern void inserisciInPila(puntatore *testa, int x, int y);
10: extern void eliminaDallaPila(puntatore *testa);
11: extern void svuotaPila(puntatore *testa);
12: extern int **allocaLabirinto(int m, int n);
...

这是另一个 .h 文件中定义“puntatore”类型的代码

...
10: typedef struct pila{
11:     int x;
12:     int y;
13:     struct pila *prossimo;
14: } posizionePila;
15: typedef posizionePila *puntatore;
...

例如我给你看第一个函数(inserisciInPila())

...
void inserisciInPila(puntatore *testa, int x, int y){
    puntatore temp;
    temp = malloc(sizeof(posizionePila));
    if(temp==NULL)
        return(NULL);

    temp->x = x;
    temp->y = y;
    temp->prossimo = *testa;
    *testa = temp;
}
...

你能帮帮我吗?谢谢!

【问题讨论】:

    标签: c compilation mingw


    【解决方案1】:

    在尝试将 puntatore 类型的声明用作函数参数类型之前,您需要确保编译器可以看到它。

    【讨论】:

    • 是的,谢谢,这是一个愚蠢的错误。要编译,我需要执行这个命令:gcc -Wall *.c .. 但我收到这个错误是因为我执行了命令 gcc -Wall *。 * ..
    猜你喜欢
    • 1970-01-01
    • 2011-03-17
    • 1970-01-01
    • 2015-04-25
    • 2014-10-17
    • 2011-01-22
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多