I have a project, which has below header include map:
main.c <- main.h <- tcphelper.h <- tcptest.h <- util.h
<- udptest.h <------------- util.h
In util.h, I defined a function prototype of struct cpu_usage:
void get_cpu_usage(struct cpu_usage *cu);
Now when I compile this project by GCC, I have this redefinition error. How do solve this problem?
thanks!
In file included from udptest.h:15:0,
from main.h:10,
from main.c:7:
util.h:27:8: error: redefinition of struct cpu_usage
struct cpu_usage{
^
In file included from tcptest.h:14:0,
from tcphelper.h:10,
from main.h:9,
from main.c:7:
util.h:27:8: note: originally defined here
struct cpu_usage{
^
Aucun commentaire:
Enregistrer un commentaire