after transplanting the program today, there was an error report of “error [li005]: no definition for” during compilation, which was encountered and solved before. Today, I’m going to officially record the causes and solutions of this error.
1. Reasons
just look at the error reminder given by IAR, “error [li005]: no definition for xxxxx”, which means that xxxxx is not defined (all cases I encounter refer to a function), but find the problem yourself, and you will find that this xxxxx has been defined in other C files, and this xxxxx function has been declared in the header file corresponding to this C file, And the path of the header file has been included in the IAR settings. There should be no problem! Then I began to wonder.
2. Solutions
let’s talk about the solution to this problem:
2.1 the C file where the xxxxx function is located is not added in the project
most of this happens because you accidentally removed the C file from the project, and you haven’t noticed it. The solution is very simple. Add the C file to the project again and recompile it.
2.2 when using conditional compilation, the xxxxx function is not compiled
this is why I have this problem this time. Let me give you an example:
#define FANJIE 1
#if FANJIE
void Get_Fans(void)
{
for(int i = 0; i<100;i++);
}
#endif
Take the simple function above as an example, when FANJIE is 1, call Get_Fans() in other c files, and no error will be reported, but when FANJIE is 0, call Get_Fans() in other c files Function, it will report the error “Error[Li005]: no definition for Get_Fans”.
The solution is also very simple, just make sure that the conditional compilation can be compiled normally.
Read More:
- [Solved] STM8L151 IAR Project Compile Error: Fatal Error[Pe035]: #error directive: “Please select first the target STM8L…
- [Solved] target_link_libraries error: a missing vtable usually means the first non-inline virtual member function has no definition.
- [Solved] MDK Compile Error: error:No section matches selector – no section to be FIRST/LAST
- Keil’s duplicate definition problem: Error: L6200E: Symbol F6x8 multiply defined
- Arduino cache multiple definition error [How to Solve]
- [Solved] RK3399 Compile UBOOT Error: No rule to make target , needed by
- [Solved] Unity Error: ‘BuildPipeline‘ does not contain a definition for ‘GetBuildTargetName‘
- Keil Compile Error: ..\OBJ\USART.axf: error: L6002U: Could not open file ..\obj\sys.o: No such file or directory
- [Solved] VIVADO Compile Error: Spawn failed: No error
- Error 2 error c2491: XX: definition of dllimport static data member is not allowed
- The uibot database connection is unrecognized error: The object definition error
- ElasticSearch Create Index Error: mapper_parsing_exception Root mapping definition has unsupported parameters
- [Solved] docker failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition
- [Solved] C++ Compile Error: prerequisites are different [How to Solve]
- How to Solve Hdsc32 MDK compile error: #29 & #223-D
- [Solved] C++ Compile: error LNK2019: unresolved external “XX“
- Using Jenkins to compile APK Error [How to Solve]
- [Solved] Android Studio Compile Error: Could not determine java version from ‘11.0.8‘.
- Android studio configurate intent-filter and compile error [Solved]
- [Solved] Compile Error: cannot open include file ‘afxres.h‘