This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error: L6218E: Undefined symbol

Hi,

I'm using uVision 5 to develop a firmware, however I can't get the linker to find one of my functions.
When building, I get this error:

Error: L6218E: Undefined symbol three()

I have 3 files, main.c, Test.h, Test.c

main.c :

#include "Test.h"

int main()
{ return three();
}

Test.h :

#ifndef TEST_H
#define TEST_H

int three();

#endif

Test.c

#include "Test.h"

int three()
{ return 3;
}

All those files are at the root of my project, I know they get compiled as if I introduce a syntax error in them, compiler reports an error. Also looking at the map file produced, I see that three() was removed:

Removing test.o(i.three), (4 bytes).

For testing purposes, I had --no_remove to linker command line, map file now contains:

0x0002ba76 0x00000004 Code RO 1 i.three test.o

So obviously, the linker is well aware of my function, and will or won't remove it depending on flags.

Regardless, it reports:

.\build\uvision5\test.axf: Error: L6218E: Undefined symbol three() (referred from main.o).
Not enough information to list image symbols.

If I move the content of Test.h/.c to main.c, no problem, so the code is correct.

I suspect a linker configuration or a project configuration issue, but I'm really stuck !

Thanks for your help!