From: Yasoo on
I installed the Platform SDK and DX9.0 SDK. I am trying to compile a sample
project and I get the following error:


c:\program files\microsoft visual studio\vc98\include\xlocnum(481) : error
C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared
identifier
c:\program files\microsoft visual studio\vc98\include\xlocnum(479) : while
compiling class-template member function 'class
std:streambuf_iterator<char,struct std::char_traits<char> > __thiscall
std::num_put<char,class std:streambuf_itera
tor<char,struct std::char_traits<char> > >::do_put(class
std:streambuf_iterator<char,struct std::char_traits<char> >,class
std::ios_base &,char,long) const'


Anyone know what this might be? I put the xlocnum file that resides the PSDK
subdirectory (it's a newer file) in the project directory thinking the newer
xlocnum might work, but it returns the same errors.

Also, I set up the search paths in "Options" on the "Directories" tab for
the SDK directories, but it still finds the "xlocnum" file in my Visual
Studio directory even though I moved the SDK directories to the top of the
list (for includes, libraries, executables, and souce).

From: Joseph M. Newcomer on
Actually, you should not be using sprintf any longer. This antiquated and dangerous
function has now been replaced by the safe-string version. There is a redefinition of all
the antique unsafe functions if you include the safe-string library that causes this
message to be put out. Since you are already including the library (which causes this
message), the best solution would be to follow its advice and replace sprintf with the
safe-string version. For that matter, why are you using sprintf at all in an MFC program?
Use CString::Format!

It is an apalling state of affairs when it took 30 years to replace sprtinf with something
intelligent. I was disgusted by strcat/strcpy/sprintf back in 1975 and I still am today.

(In a fascinating exercise, I finally had to take a program I wrote in 1984, in C, and
rewrite it, since the old MS-DOS program it interfaced to no longer operates, and I've
lost the installation disks. What amazes me is the amount of effort I went through back
then to implement my own safe-string functions. There are even comments in it indicating
that sprintf is dangerous but I didn't know how to implement a safe-sprintf.)
joe

On Wed, 6 Jul 2005 06:42:02 -0700, "Yasoo" <Yasoo(a)discussions.microsoft.com> wrote:

>I installed the Platform SDK and DX9.0 SDK. I am trying to compile a sample
>project and I get the following error:
>
>
>c:\program files\microsoft visual studio\vc98\include\xlocnum(481) : error
>C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared
>identifier
>c:\program files\microsoft visual studio\vc98\include\xlocnum(479) : while
>compiling class-template member function 'class
>std:streambuf_iterator<char,struct std::char_traits<char> > __thiscall
>std::num_put<char,class std:streambuf_itera
>tor<char,struct std::char_traits<char> > >::do_put(class
>std:streambuf_iterator<char,struct std::char_traits<char> >,class
>std::ios_base &,char,long) const'
>
>
>Anyone know what this might be? I put the xlocnum file that resides the PSDK
>subdirectory (it's a newer file) in the project directory thinking the newer
>xlocnum might work, but it returns the same errors.
>
>Also, I set up the search paths in "Options" on the "Directories" tab for
>the SDK directories, but it still finds the "xlocnum" file in my Visual
>Studio directory even though I moved the SDK directories to the top of the
>list (for includes, libraries, executables, and souce).

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Yasoo on
Interesting. I'll give that a try using the other function. I didn't
realize that was actually advising me. :)

It's a tutorial project. I'm completely in the dark on the concepts
involved (DirectX classes), so I have to take this project, compile it, see
what it does, etc.

"Joseph M. Newcomer" wrote:

> Actually, you should not be using sprintf any longer. This antiquated and dangerous
> function has now been replaced by the safe-string version. There is a redefinition of all
> the antique unsafe functions if you include the safe-string library that causes this
> message to be put out. Since you are already including the library (which causes this
> message), the best solution would be to follow its advice and replace sprintf with the
> safe-string version. For that matter, why are you using sprintf at all in an MFC program?
> Use CString::Format!
>
> It is an apalling state of affairs when it took 30 years to replace sprtinf with something
> intelligent. I was disgusted by strcat/strcpy/sprintf back in 1975 and I still am today.
>
> (In a fascinating exercise, I finally had to take a program I wrote in 1984, in C, and
> rewrite it, since the old MS-DOS program it interfaced to no longer operates, and I've
> lost the installation disks. What amazes me is the amount of effort I went through back
> then to implement my own safe-string functions. There are even comments in it indicating
> that sprintf is dangerous but I didn't know how to implement a safe-sprintf.)
> joe
>
> On Wed, 6 Jul 2005 06:42:02 -0700, "Yasoo" <Yasoo(a)discussions.microsoft.com> wrote:
>
> >I installed the Platform SDK and DX9.0 SDK. I am trying to compile a sample
> >project and I get the following error:
> >
> >
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(481) : error
> >C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared
> >identifier
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(479) : while
> >compiling class-template member function 'class
> >std:streambuf_iterator<char,struct std::char_traits<char> > __thiscall
> >std::num_put<char,class std:streambuf_itera
> >tor<char,struct std::char_traits<char> > >::do_put(class
> >std:streambuf_iterator<char,struct std::char_traits<char> >,class
> >std::ios_base &,char,long) const'
> >
> >
> >Anyone know what this might be? I put the xlocnum file that resides the PSDK
> >subdirectory (it's a newer file) in the project directory thinking the newer
> >xlocnum might work, but it returns the same errors.
> >
> >Also, I set up the search paths in "Options" on the "Directories" tab for
> >the SDK directories, but it still finds the "xlocnum" file in my Visual
> >Studio directory even though I moved the SDK directories to the top of the
> >list (for includes, libraries, executables, and souce).
>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
From: Yasoo on
Ya know, that "XLOCUM" file is part of the new SDK in the "include"
subdirectory.

I #if 0'd the functions with the sprintf in them. Maybe the project won't
need them. :) fingers crossed...

"Joseph M. Newcomer" wrote:

> Actually, you should not be using sprintf any longer. This antiquated and dangerous
> function has now been replaced by the safe-string version. There is a redefinition of all
> the antique unsafe functions if you include the safe-string library that causes this
> message to be put out. Since you are already including the library (which causes this
> message), the best solution would be to follow its advice and replace sprintf with the
> safe-string version. For that matter, why are you using sprintf at all in an MFC program?
> Use CString::Format!
>
> It is an apalling state of affairs when it took 30 years to replace sprtinf with something
> intelligent. I was disgusted by strcat/strcpy/sprintf back in 1975 and I still am today.
>
> (In a fascinating exercise, I finally had to take a program I wrote in 1984, in C, and
> rewrite it, since the old MS-DOS program it interfaced to no longer operates, and I've
> lost the installation disks. What amazes me is the amount of effort I went through back
> then to implement my own safe-string functions. There are even comments in it indicating
> that sprintf is dangerous but I didn't know how to implement a safe-sprintf.)
> joe
>
> On Wed, 6 Jul 2005 06:42:02 -0700, "Yasoo" <Yasoo(a)discussions.microsoft.com> wrote:
>
> >I installed the Platform SDK and DX9.0 SDK. I am trying to compile a sample
> >project and I get the following error:
> >
> >
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(481) : error
> >C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared
> >identifier
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(479) : while
> >compiling class-template member function 'class
> >std:streambuf_iterator<char,struct std::char_traits<char> > __thiscall
> >std::num_put<char,class std:streambuf_itera
> >tor<char,struct std::char_traits<char> > >::do_put(class
> >std:streambuf_iterator<char,struct std::char_traits<char> >,class
> >std::ios_base &,char,long) const'
> >
> >
> >Anyone know what this might be? I put the xlocnum file that resides the PSDK
> >subdirectory (it's a newer file) in the project directory thinking the newer
> >xlocnum might work, but it returns the same errors.
> >
> >Also, I set up the search paths in "Options" on the "Directories" tab for
> >the SDK directories, but it still finds the "xlocnum" file in my Visual
> >Studio directory even though I moved the SDK directories to the top of the
> >list (for includes, libraries, executables, and souce).
>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
From: Yasoo on
Joe -

Myself, I have no issues with strcat,strcpy,sprintf/etc. I actually like
them. I still don't understadnd why I am getting the error - I never have
before. I thought maybe installing the SDK might have something to do with
it, but I can create a new project as usual and use strcat just fine.
Something about the sample project? An include file that #defines something
which in turn will give me that error. I went hand by hand and switched
them, but I'd rather know how to tell it strcat is ok to use. Do you know
how?

"Joseph M. Newcomer" wrote:

> Actually, you should not be using sprintf any longer. This antiquated and dangerous
> function has now been replaced by the safe-string version. There is a redefinition of all
> the antique unsafe functions if you include the safe-string library that causes this
> message to be put out. Since you are already including the library (which causes this
> message), the best solution would be to follow its advice and replace sprintf with the
> safe-string version. For that matter, why are you using sprintf at all in an MFC program?
> Use CString::Format!
>
> It is an apalling state of affairs when it took 30 years to replace sprtinf with something
> intelligent. I was disgusted by strcat/strcpy/sprintf back in 1975 and I still am today.
>
> (In a fascinating exercise, I finally had to take a program I wrote in 1984, in C, and
> rewrite it, since the old MS-DOS program it interfaced to no longer operates, and I've
> lost the installation disks. What amazes me is the amount of effort I went through back
> then to implement my own safe-string functions. There are even comments in it indicating
> that sprintf is dangerous but I didn't know how to implement a safe-sprintf.)
> joe
>
> On Wed, 6 Jul 2005 06:42:02 -0700, "Yasoo" <Yasoo(a)discussions.microsoft.com> wrote:
>
> >I installed the Platform SDK and DX9.0 SDK. I am trying to compile a sample
> >project and I get the following error:
> >
> >
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(481) : error
> >C2065: 'sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA' : undeclared
> >identifier
> >c:\program files\microsoft visual studio\vc98\include\xlocnum(479) : while
> >compiling class-template member function 'class
> >std:streambuf_iterator<char,struct std::char_traits<char> > __thiscall
> >std::num_put<char,class std:streambuf_itera
> >tor<char,struct std::char_traits<char> > >::do_put(class
> >std:streambuf_iterator<char,struct std::char_traits<char> >,class
> >std::ios_base &,char,long) const'
> >
> >
> >Anyone know what this might be? I put the xlocnum file that resides the PSDK
> >subdirectory (it's a newer file) in the project directory thinking the newer
> >xlocnum might work, but it returns the same errors.
> >
> >Also, I set up the search paths in "Options" on the "Directories" tab for
> >the SDK directories, but it still finds the "xlocnum" file in my Visual
> >Studio directory even though I moved the SDK directories to the top of the
> >list (for includes, libraries, executables, and souce).
>
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>