Compiler Error L6218E

  • Incorrect Types in function headers. For example:

void foo(unsigned char * foo1);
void foo(char*foo1){};
  • Or not initializing a static member of a class, e.g.:

class Foo {
  public:
    static int bar;
    static void isr();
};

void Foo::isr() {
    bar++;
}

// WILL FAIL WITHOUT THIS INITIALIZATION:
int Foo::bar = 0;

int main() { while (1) ; }
  • Or failure to define a virtual function in a class that is instantiated, or has child classes that are instantiated.
    • The linker may display the errors "Undefined symbol typeinfo for Example" or "Undefined symbol vtable for Example."
    • This shouldn't apply to abstract virtual functions, although mbed currently doesn't allow abstract virtual functions or abstract classes.

#include "mbed.h"
#include "example-class.h"

class Example
{
    public:
    virtual int func1();
}; 

//class Example is instantiated, generating a linker error
//"Undefined symbol vtable for Example"
Example foo;

int main() 
{
    while(1) 
    {
        //code...
    }
}

//defining the virtual function fixes the linker error
/*
int Example::func1()
{ return 0;  }
*/

All wikipages