The only way to do this that came to my mind was to completely disable 
optimizations, but it didn't work.

The only other reason for this that comes to my mind is that something wrong 
with include order, but I see nothing weird in output produced with 
/showIncludes option. I attached it if you would like to take a look.

One, but probably not perfect solution is to guard

```
#undef sprintf
```

to not undef it for MSVC compilations.

- Kirill Makurin
________________________________
From: Bruno Haible <br...@clisp.org>
Sent: Tuesday, June 10, 2025 11:40 PM
To: bug-gnulib@gnu.org <bug-gnulib@gnu.org>; Kirill Makurin 
<maiddais...@outlook.com>
Subject: Re: clang-cl: undeclared library function 'sprintf'

Kirill Makurin wrote:
> In MSVC headers, sprintf and friends can be either simply declared as
> externals or defined as inline functions. It seems to be controlled
> some internal (not documented) macro. I believe it should always be
> visible as an inline function to user code.

I would try to force the MSVC headers to declare 'sprintf' as 'extern',
not inline.

Bruno



Attachment: includes.txt.gz
Description: includes.txt.gz

Reply via email to