none
I need help fixing a rather special? LNK2001 error RRS feed

  • Question

  • I need help fixing this piece of spaghetti but nothing of the previous fixes that I saw her worked out. I'll drop here an ss of the errors and stuff, I think that'll be best.

    https://prntscr.com/ozcrv9

    Friday, August 30, 2019 7:41 AM

All replies

  • Hello,

    you could write the linker error instead of making a photo.

    Linker error is: LNK2001: unresolved external symbol _snprintf

    Read this: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019

    _snprintf is used for MBCS defined. Do you use UNICODE or Multi Byte character set?

    You should use the TCHAR Routine _sntprintf instead.

    Regards, Guido

    Friday, August 30, 2019 8:33 AM
  • There was a breaking change regarding linker errors and the printf family of functions beginning with VS2015.  The suggested solutions are to make sure that there is a #include for stdio.h or to link with legacy_stdio_definitions.lib.

    https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015?view=vs-2019#stdioh-and-conioh

    Friday, August 30, 2019 10:59 AM
  • One thing you should be aware of is that the unresolved symbols imply that the object/library you are linking to was not built with Visual Studio 2015 or later. This matters because while 2015 and newer maintain binary compatibility, 2013 and older are not binary compatible with 2015 or newer.

    This is worth mentioning because if you are linking to a C++ static library that was built with an older version of Visual Studio then this could cause major problems. For example, the basic STL types can change so the layout of the classes can change and this can cause corruption.

    So check that the libraries that you are using, especially third party libraries, are built with Visual Studio 2015 or newer.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Friday, August 30, 2019 5:37 PM