Hello, As part of my attempts to build some GNU packages with MSVC tools, I also tried to build them with LLVM tools which can be installed with Visual Studio (clang-cl.exe and lld-link.exe).
When compiling source files lib/strerror.c and lib/vasnprintf.c (and possibly some other) the following error occurs: ``` H:/releases/gettext-0.25/libtextstyle/lib/strerror.c(64,7): error: call to undeclared library function 'sprintf' with type 'int (char *restrict, const char *restrict, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 64 | sprintf (buf, fmt, n); | ^ H:/releases/gettext-0.25/libtextstyle/lib/strerror.c(64,7): note: include the header <stdio.h> or explicitly provide a declaration for 'sprintf' 1 error generated. ``` If I pass `-Wno-error=implicit-function-declaration` to make it non-fatal warning, link will fail: ``` libtextstyle_la-strerror.obj : error LNK2019: unresolved external symbol sprintf referenced in function libtextstyle_rpl_strerror libtextstyle_la-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf ``` or in case of libunistring: ``` libunistring_la-u8-u8-vasnprintf.obj : error LNK2019: unresolved external symbol sprintf referenced in function u8_u8_vasnprintf libunistring_la-u8-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf libunistring_la-ulc-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf libunistring_la-u16-u16-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf libunistring_la-u16-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf libunistring_la-u32-u32-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf libunistring_la-u32-vasnprintf.obj : error LNK2001: unresolved external symbol sprintf ``` AFAIK, sprintf and friends are defined in Microsoft's header files as inline functions. There is no real external sprintf and friends. One notable thing about these source files is that they both contain ``` #undef sprintf ``` However, I do not think that this is the issue. I do not fully understand what causes it. I observed this when tried to build gettext and libunstring packages. - Kirill Makurin