Share via


error C3861: 'snprintf': identifier not found

Question

Wednesday, January 11, 2006 9:21 PM

Hello everyone,

When I tried to compile a C++ files in Visual Studio 2005, I got this error: C3861: 'snprintf': identifier not found.  I suspect some standard C lib are missing but not sure what they are. Can someone please give a pointer? thanks a lot for your help.

 

All replies (2)

Thursday, January 12, 2006 7:26 AM âś…Answered

Its _snprintf or the corresponding new safe function would be sprintf_s
http://msdn2.microsoft.com/en-us/library/ce3zzk1k.aspx


Thursday, March 22, 2007 4:52 PM

Hi,

I'm trying to create a dll file by compiling some *.cpp files. But the error i get is:

1>.\intelbth.cpp(836) : error C3861: 'sprintf_s': identifier not found

And the line which it refers to in the code is:

sprintf_s(errmsg,"Failed to bind socket; error = %d", WSAGetLastError());

I went through the linked that you was provided for the same error, and I concluded (not sure if i'm correct or not) that I need to include the header file <stdio.h>. I do that, but I still have the same problem. The program has #include "stdafx.h" as the header file, and when i look into it, it has the following code as part of its coding:

// TODO: reference additional headers your program requires here

#include <stdio.h>

#include <stdlib.h>

#include <tchar.h>

I would really appreciate if you would help me out to fix the error to compile my program. (Below, I have pasted what was written in the Buildlog file for further reference:

Command Lines:

Creating temporary file "c:\Documents and Settings\Administrator\Desktop\Benhui\BlueCove Stack\sourceforge.net\bluecove-1.2.1-src\bluecove-1.2.1-src\intelbth\Pocket PC 2003 (ARMV4)\Debug\RSP00000322803612.rsp" with contents

[

/O2 /Os /I "C:\Program Files\Java\jdk1.5.0_08\include" /I "C:\Program Files\Java\jdk1.5.0_08\include\win32" /D "_DEBUG" /D "_WIN32_WCE=0x420" /D "UNDER_CE" /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CEINTELBTH_EXPORTS" /D "ARM" /D "_ARM_" /D "_UNICODE" /D "UNICODE" /D "_WINDLL" /Gm /EHsc /MTd /fp:fast /GR /Yu"stdafx.h" /Fp"Pocket PC 2003 (ARMV4)\Debug/intelbth.pch" /Fo"Pocket PC 2003 (ARMV4)\Debug/" /Fd"Pocket PC 2003 (ARMV4)\Debug/vc80.pdb" /W3 /c /Zi /TP

 

".\intelbth.cpp"

]

Creating command line "cl.exe @"c:\Documents and Settings\Administrator\Desktop\Benhui\BlueCove Stack\sourceforge.net\bluecove-1.2.1-src\bluecove-1.2.1-src\intelbth\Pocket PC 2003 (ARMV4)\Debug\RSP00000322803612.rsp" /nologo"

Thank you,

Sonya