[英]How to fix “ implicit declaration of function”
I'm working on a GUI library in C for a school work, but I've got a problem with header files (I think). 我正在使用C的GUI库进行学校作业,但是头文件存在问题(我认为)。 I have a function "rectangle_coordinates" in a "draw.c" file, with the adequate "draw.h" header file, and in a file "widget_frame.c" I call this function, after including the "draw.h" header file.
我在“ draw.c”文件中有一个函数“ rectangle_coordinates”,带有足够的“ draw.h”头文件,在文件“ widget_frame.c”中,我在包含“ draw.h”头之后调用了此函数文件。 But I still got a warning :
但是我仍然得到警告:
./src/ei_widget_frame.c:40:5: warning: implicit declaration of function 'rectangle_coordinates' [-Wimplicit-function-declaration]
rectangle_coordinates(&frame_to_draw, &xmin, &xmax, &ymin, &ymax);
Do you have an idea that can fix my problem ? 您有解决我问题的想法吗?
At a minimum, all things below should be verified and corrected (if needed). 至少,应验证和纠正以下所有内容(如果需要)。
In draw.h
you should have something like: 在
draw.h
您应该具有以下内容:
extern /type/ rectangle_coordinates(&frame_to_draw, &xmin, &xmax, &ymin, &ymax);
where: 哪里:
In both draw.c
and ei_widget_frame.c
you should have: 在
draw.c
和ei_widget_frame.c
您都应具有:
#include "draw.h"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.