简体   繁体   中英

Why do I get a implicit declaration of function 'cambiar_color' is invalid in C99 error

So I included in my header

#include <stdio.h>
#include "colores.h"

...

    do{
        tablero[gusano.posFila][gusano.posColumna] = '@';
        for(int i=0; i<FILAS; i++){
            for(int j=0; j<COL; j++){
                if(tablero[i][j] == '#')
                    cambiar_color(WHITE);
                else if(tablero[i][j] == '@')
                    cambiar_color(GREEN);
                else if(tablero[i][j] == '%')
                    cambiar_color(RED);
                printf("%c", tablero[i][j]);
            }
            printf("\n");
        }
        usleep(1000000);
    }while(tablero[gusano.posFila][gusano.posColumna] != '#');
    
    return 0;
}

This part is the only part where i wrote anything related to the colores.h header

I compiled the program using gcc myfile.c colores.c -o myfile but I get this error. (I used cambiar_color(WHITE) as an example in the program

You get an implicit declaration error because cambiar_color() is not declared in your program. Check your header file for the declaration of the function, and if there is no declaration, add one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM