Unsolved external symbol "sprintf_s" while making windows native application. Visual Studio 2022

113 Views Asked by At

I am using Visual studio 2022 and am trying to make a windows native application in c. That means I can also link against ntdll.lib. I am trying to use the function sprintf_s and the linker throws an error. I am trying to use sprintf_s like this

WCHAR str[255];
sprintf_s(str, 255, L"ERROR: Unable to open keyboard device. Error code: %02x", status);

I tried searching google and it didn't give me any results and I also did try to manually declare it in a header file.

Like this

int sprintf_s(
    char* buffer,
    size_t sizeOfBuffer,
    const char* format,
    ...
);

And yet it still does not work. Could anyone please help me with this? Thanks!

0

There are 0 best solutions below