joseangelmt
joseangelmt

Reputation: 2148

VS2015: LNK2019 error when linking with Muiload.lib

I'm experimenting the next error when including muiload.h and linking with muiload.lib and calling LoadMUILibrary in Visual Studio 2015:

Muiload.lib(muiload.obj) : error LNK2019: unresolved external symbol __vsnwprintf referenced in function "long __stdcall StringVPrintfWorkerW(unsigned short *,unsigned int,unsigned int *,unsigned short const *,char *)" (?StringVPrintfWorkerW@@YGJPAGIPAIPBGPAD@Z)

Maybe something wrong in muiload.lib?

Upvotes: 7

Views: 4618

Answers (2)

Vinz
Vinz

Reputation: 3198

An alternative to linking against legacy_stdio_definitions.lib is to redefine these function signatures to match their deprecated style:

int (WINAPIV * __vsnprintf)(char *, size_t, const char*, va_list) = _vsnprintf;
int (WINAPIV * __vsnwprintf)(wchar_t *, size_t, const wchar_t*, va_list) = _vsnwprintf;

One benefit of this is that it avoids other possible linker definition issues caused by including the legacy library.

Note that this should be defined in a compiler unit (.cpp) rather than in a header file.

Upvotes: 1

joseangelmt
joseangelmt

Reputation: 2148

Solved adding the additional library legacy_stdio_definitions.lib to the linker input as explained in https://social.msdn.microsoft.com/Forums/en-US/5150eeec-4427-440f-ab19-aecb26113d31/updated-to-vs-2015-and-now-get-unresolved-external-errors?forum=vcgeneral

Upvotes: 16

Related Questions