351
There is no compilation function in the header file. Only the source file can be compiled.
The header file cannot be compiled separately.
(6)When two source files call the header file, you only need to write a declaration in one source
file. Write in both source files and compile correctly, but the download program is wrong.
Using #include "xxx.h" outside the function can be understood as including this header file
globally. There is no problem compiling a source file separately.
The function of the header file can be understood as: the compiler replaces #include "xxx.h"
with variables and functions declared in the header file during code preprocessing.
However, during the download process, multiple source files are compiled and linked. After
preprocessing, both source files have declarations of variables and functions in the header file.
Repeated declaration errors will occur during linking, and XDPpro is shown as a link error.
Suggestion:
Correctly include the header file where the header file content needs to be used, rather
than blindly include the header file directly outside the function.
tudonghoatoancau.com