keil5 multiply define
时间: 2024-01-15 07:00:15 浏览: 91
"multiply defined" error in Keil 5 typically occurs when a function, variable or object is defined in multiple source files. This error occurs during the linking stage of the compilation process when the linker tries to merge all the object files into a single executable.
To resolve this error, you need to identify the duplicate definitions and remove one of them. Here are some possible solutions:
1. Check if you have included the same header file in multiple source files. If so, remove the duplicate inclusion.
2. Check if you have defined the same function or variable in multiple source files. If so, remove the duplicate definition.
3. If you have two source files with the same name but located in different folders, ensure that you have included the correct file in your project.
4. Check if you have declared a global variable in a header file and included it in multiple source files. In this case, move the definition of the global variable to a single source file and declare it as extern in the other source files.
5. If you are using a library, ensure that you are not including the same library in multiple source files.
6. Check if you have accidentally used the same name for two different functions or variables.
Once you have identified and removed the duplicate definitions, rebuild your project and the "multiply defined" error should be resolved.
阅读全文