Cannot call other functions after function definition

Project scene:

Use ART-Pi to develop based on RT-Thread


Problem Description:

When using RTT for development, a thread is defined in a function c file, and I want to call it in another function file. I found that the error has not been defined, and the error is as follows:

D:\RT-ThreadStudio\workspace\art_pi_factory_1\modules\OLE/oled.h:15:13: warning: 'oled_init' declared 'static' but never defined [-Wunused-function]
 static void oled_init(void);
             ^
../modules/OLE/oled.c:15:13: warning: 'oled_init' defined but not used [-Wunused-function]
 static void oled_init(void)
             ^
In file included from ../applications/main.c:18:0:
D:\RT-ThreadStudio\workspace\art_pi_factory_1\modules\OLE/oled.h:15:13: warning: 'oled_init' used but never defined
 static void oled_init(void);

Cause Analysis:

The error shows that oled_init() is not defined; but oled_init() has been defined and the reference method is normal, and then carefully analyze the definition of oled_init, as follows

	static void oled_init(void);

Then Baidu, to solve the problem, static defined variables or functions can only be called in local files, and cannot be called by other c files. If you want to call in other c files, you must define them as global variables; the definition is as follows

	void oled_init(void);

Compile pass
Insert picture description here


solution:

Delete the static static definition and change it to a global definition function so that it can be called in other c files!

Guess you like

Origin blog.csdn.net/qq_45396672/article/details/112847505