Error: No previous prototype for function. Why am I getting this error?

前端 未结 3 1898
耶瑟儿~
耶瑟儿~ 2020-12-09 02:12

// screen.h

#ifndef screen_h
#define screen_h

#define MAC  1
#define WIN  2
#define LNX  3

#ifdef PLATFORM 
# undef PLATFORM 
#endif

#define PLATFORM MAC
         


        
3条回答
  •  余生分开走
    2020-12-09 02:32

    ISO/IEC 9899:TC2 - 6.2.1.2:
    A function prototype is a declaration of a function that declares the types of its parameters.

    An empty argument list in a function declaration indicates that the number and type of parameters is not known. You must explicitly indicate that the function takes no arguments by using the void keyword. Otherwise your function declaration does not count as a valid prototype.

    void screen_init(void);
    

提交回复
热议问题