Linker errors L6218E

Hello, i am just done with programming my nucleoL432KC. I have no compiler errors but i got 39 linking errors i cannot quite wrap my finger around it. Can anybody tell me what to do?

Finished: 0 information, 1 warning and 39 error messages.

[ERROR] Warning: L3912W: Option ‘legacyalign’ is deprecated.

Error: L6218E: Undefined symbol Dentas::motorMove(Dentas::motor_t) (referred from BUILD/NUCLEO_L432KC/ARMC6/MyLib/Dentas.o).

Error: L6218E: Undefined symbol wmemcpy (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(ios.cpp.o)).

Error: L6218E: Undefined symbol wmemset (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(ios.cpp.o)).

Error: L6218E: Undefined symbol __ARM_snprintf (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol __ARM_vasprintf (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol __ARM_vsnprintf (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol __ARM_vsscanf (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol _mbsnrtowcs (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol _wcsnrtombs (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol btowc (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswalpha (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswblank (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswcntrl (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswdigit (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswlower (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswprint (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswpunct (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswspace (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswupper (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol iswxdigit (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol mbrlen (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol mbsrtowcs (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol mbtowc (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol towlower (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol towupper (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol wcscoll (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol wcsxfrm (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol wctob (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(locale.cpp.o)).

Error: L6218E: Undefined symbol __2swprintf (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wcslen (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wcstol (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wcstoll (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wcstoul (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wcstoull (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wmemchr (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wmemcmp (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol wmemmove (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\libcxx\libcpp_w.l(string.cpp.o)).

Error: L6218E: Undefined symbol __wcstod_int (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\armlib\m_wm.l(wcstod.o)).

Error: L6218E: Undefined symbol __wcstof_int (referred from c:\ProgramData\Mbed Studio\mbed-studio-tools\ac6\bin..\lib\armlib\m_wm.l(wcstof.o)).

HI,

I had same issue. I fixed it in online compiler by filling in dummy function definitions in a source file

extern "C"{
   wchar_t* wmemcpy (wchar_t* destination, const wchar_t* source, size_t num){return nullptr;}
   wchar_t* wmemset (wchar_t* ptr, wchar_t wc, size_t num){return nullptr;}
   int __ARM_snprintf ( char * s, size_t n, const char * format, ... ){return 0;}
   int __ARM_vasprintf (char **ret, const char *format, va_list ap){return 0;}
   int __ARM_vsnprintf (char * s, size_t n, const char * format, va_list arg ){return 0;}
   int __ARM_vsscanf ( const char * s, const char * format, va_list arg ){return 0;}
   size_t _mbsnrtowcs ( wchar_t * restrict_dest, const char** restrict_src, size_t nms, size_t len, mbstate_t* restrict_ps){return 0;}
   size_t _wcsnrtombs(char *restrict_dest, const wchar_t **restrict_src, size_t nwc, size_t len, mbstate_t * restrict_ps){return 0;}
   wint_t btowc (int c){return 0;}
   int iswalpha( wint_t ch ){return 0;}
   int  iswcntrl( wint_t ch ){return 0;}
   int  iswdigit( wint_t ch ){return 0;}
   int  iswlower( wint_t ch ){return 0;}
   int  iswprint( wint_t ch ){return 0;}
   int  iswpunct( wint_t ch ){return 0;}
   int  iswspace( wint_t ch ){return 0;}
   int  iswupper( wint_t ch ){return 0;}
   int  iswxdigit( wint_t ch ){return 0;}
   size_t mbrlen (const char* pmb, size_t max, mbstate_t* ps){return 0;}
   size_t mbsrtowcs (wchar_t* dest, const char** src, size_t max, mbstate_t* ps){return 0;}
   int mbtowc (wchar_t* pwc, const char* pmb, size_t max){return 0;}
   wint_t towlower ( wint_t c ){return 0;}
   wint_t towupper ( wint_t c ){return 0;}
   int wcscoll (const wchar_t* wcs1, const wchar_t* wcs2){return 0;}
   size_t wcsxfrm (wchar_t* destination, const wchar_t* source, size_t num){return 0;}
   int wctob (wint_t wc){return 0;}
   int __2swprintf (wchar_t* ws, size_t len, const wchar_t* format, ...){return 0;}
   size_t wcslen( const wchar_t *str ){return 0;}
   long int wcstol (const wchar_t* str, wchar_t** endptr, int base){return 0;}
   unsigned long int wcstoul (const wchar_t* str, wchar_t** endptr, int base){return 0;}
   unsigned long long int wcstoull (const wchar_t* str, wchar_t** endptr, int base){return 0;}
   double __wcstod_int( const wchar_t* str, wchar_t** str_end ){return 0;}
   float __wcstof_int( const wchar_t* str, wchar_t** str_end ){return 0;}
   wchar_t* wmemchr (const wchar_t* ptr, wchar_t wc, size_t num){return 0;}
   int wmemcmp (const wchar_t* ptr1, const wchar_t* ptr2, size_t num){return 0;}
   wchar_t* wmemmove (wchar_t* destination, const wchar_t* source, size_t num){return nullptr;}
   int iswblank (wint_t c){return 0;}
   long long int strtoll (const char* str, char** endptr, int base){return 0;}
   long long int wcstoll (const wchar_t* str, wchar_t** endptr, int base){return 0;}
}

Thank you that solved the problem and the project build successfully :slight_smile:

Here are several examples of code that causes a LNK2019 error, together with information about how to fix the error.

A symbol is declared but not defined
In this example, an external variable is declared but not defined:

C++

Copy
// LNK2019.cpp
// Compile by using: cl /EHsc /W4 LNK2019.cpp
// LNK2019 expected
extern char B[100]; // B isn’t available to the linker
int main() {
B[0] = ’ '; // LNK2019
}
Here is another example where a variable and function are declared as extern but no definition is provided:

C++

Copy
// LNK2019c.cpp
// Compile by using: cl /EHsc LNK2019c.cpp
// LNK2019 expected
extern int i;
extern void g();
void f() {
i++;
g();
}
int main() {}
Unless i and g are defined in one of the files included in the build, the linker generates LNK2019. You can fix the errors by including the source code file that contains the definitions as part of the compilation. Alternatively, you can pass .obj files or .lib files that contain the definitions to the linker.

Regards,
Rachel Gomez