several typical case that trigger the error of “multiple defination”
1 the most obvious reason is the typo, you may declare a function several times.
2 the second reason is that, you declare functions in .h file and implement the function at the .c file, but you forgot to use the # ifdefine
at the beginning of the .h file and #endif
at the end of the file, or there are some typos here.
3 if you want to declare a variable in .h file, you need to declare it by using extern
keyword and init it at the .c files instead of using it direactly.
4 you may only want a .h
file for some util functions and this utils file might be included by several .c file, it is better to use the static inline
at the .h
file to declare every functions in this case.