Terminal failed to build on MSVC on Windows with error: error C3861: '_vsnwprintf_s': identifier not found #20104

Closed
opened 2026-01-31 07:03:42 +00:00 by claunia · 3 comments
Owner

Originally created by @KawasakiNinjaH2R on GitHub (Jun 16, 2023).

Windows Terminal version

v1.17.11461.0

Windows build number

10.0.22621.0

Other Software

VS2022 + Windows 10

Steps to reproduce

  1. Download the attachment file: main.zip and unzip it.
  2. Open x64 Native Tools Command Prompt for VS 2022.
  3. CL.exe /c /Zi /nologo /W4 /WX /diagnostics:column /sdl /MP /O2 /Oi /GL /Zc:preprocessor /Gm- /EHsc /MT /GS /guard:cf /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /std:c++20 /permissive- /external:W4 /Gd /TP /wd4201 /wd4312 /wd4467 /wd5105 /wd26445 /wd26813 /FC /errorReport:queue /we4189 /we4100 /we4242 /we4389 /we4244 /utf-8 /Zc:externConstexpr /Zc:lambda /Zc:throwingNew /fp:contract main.i

Expected Behavior

build success

Actual Behavior

F:\gitP\microsoft\terminal\src\tools\RenderingTests\main.cpp(69,25): error C3861: '_vsnwprintf_s': identifier not found [F:\gitP\microsoft\terminal\src\tools\RenderingTests\RenderingTests.vcxproj]
main.zip

Originally created by @KawasakiNinjaH2R on GitHub (Jun 16, 2023). ### Windows Terminal version v1.17.11461.0 ### Windows build number 10.0.22621.0 ### Other Software VS2022 + Windows 10 ### Steps to reproduce 1. Download the attachment file: main.zip and unzip it. 2. Open x64 Native Tools Command Prompt for VS 2022. 3. CL.exe /c /Zi /nologo /W4 /WX /diagnostics:column /sdl /MP /O2 /Oi /GL /Zc:preprocessor /Gm- /EHsc /MT /GS /guard:cf /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /std:c++20 /permissive- /external:W4 /Gd /TP /wd4201 /wd4312 /wd4467 /wd5105 /wd26445 /wd26813 /FC /errorReport:queue /we4189 /we4100 /we4242 /we4389 /we4244 /utf-8 /Zc:externConstexpr /Zc:lambda /Zc:throwingNew /fp:contract main.i ### Expected Behavior build success ### Actual Behavior F:\gitP\microsoft\terminal\src\tools\RenderingTests\main.cpp(69,25): error C3861: '_vsnwprintf_s': identifier not found [F:\gitP\microsoft\terminal\src\tools\RenderingTests\RenderingTests.vcxproj] [main.zip](https://github.com/microsoft/terminal/files/11768388/main.zip)
claunia added the Issue-QuestionNeeds-TriageNeeds-Attention labels 2026-01-31 07:03:42 +00:00
Author
Owner

@lhecker commented on GitHub (Jun 16, 2023):

That function is part of the UCRT and should at least be present in the 22621 SDK and later. Could you verify that you have the 22621 SDK installed? You can verify if the file at least exists and the function is defined by opening:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_wstdio.h

It should be on line 1094.

@lhecker commented on GitHub (Jun 16, 2023): That function is part of the UCRT and should at least be present in the 22621 SDK and later. Could you verify that you have the 22621 SDK installed? You can verify if the file at least exists and the function is defined by opening: ``` C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_wstdio.h ``` It should be on line 1094.
Author
Owner

@KawasakiNinjaH2R commented on GitHub (Jun 20, 2023):

Thanks for your information! I add :

#include <corecrt_wstdio.h>

to main.cpp, it can be compiled successfully!

@KawasakiNinjaH2R commented on GitHub (Jun 20, 2023): Thanks for your information! I add : `#include <corecrt_wstdio.h>` to main.cpp, it can be compiled successfully!
Author
Owner

@lhecker commented on GitHub (Jul 13, 2023):

I also hit this issue now after upgrading Visual Studio! I wonder if it's because the STL got updated? In any case I just added <cstdio> as an include and it works. I'll add it to a future PR.

@lhecker commented on GitHub (Jul 13, 2023): I also hit this issue now after upgrading Visual Studio! I wonder if it's because the STL got updated? In any case I just added `<cstdio>` as an include and it works. I'll add it to a future PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20104