VC编译错误:error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared

 
VC编译错误:error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared
2011-01-05 23:42

经过尝试 第一种方法为我解决了问题 其它并没有 但是确实是direct sdk的问题 最后一种是更改函数,但是相对麻烦,因为参数也将修改。

一:

今天想看一个人的VC的源码。今天开发报错:err C2065: "sprintf_instead_use_StringCbPrintfA_or_StringCchPrintfA" : undeclared identifer.

不知道何解,最终在一个韩国的博客找了解决版本

Project >Settings > C/C++ > Gerneral > Preprocessor definitions
STRSAFE_NO_DEPRECATE

后记,为了这个VC的源码,我装了VC6+DirectX SDK9(extra)(dshow.h缺失要求的)+Platform SDK(strsafe.h No such file or directory)

发现安装DirectX SDK9跟Platform SDK core SDK效果一样里面都有strsafe.h这个库。

http://www.sunnybtoc.com/page/M0/S209/209861.html

 

 

二:

C:\Documents and Settings\Administrator\桌面\Chapter07\DsDemo\DsDemoDlg.cpp(196) : error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\Chapter07\DsDemo\DsDemoDlg.cpp(197) : error C2065: 'strcat_instead_use_StringCbCatA_or_StringCchCatA' : undeclared identifier

解决方法:在包含direct sdk的头文件之前加上#include <strsafe.h>

参考:http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/b06cd738-f3e8-4f2b-8268-69a2a6d3de11/

这样一来,会出现重复定义的报警信息,解决方法如下:
#pragma warning( disable : 4996 )
#include <strsafe.h>
#pragma warning( default : 4996 )

参考:http://www.programfan.com/blog/article.asp?id=34552

 

 三:

hi~
I have installed visual studio 6.0, DirectX 8.1 sdk, msxml 4.0, psdk windows server 2003 sp1 in my system.(os : window xp professional)
When I compile my application.I am getting a lot of errors.
" error C2065: 'strcpy_instead_use_StringCbCopyA_or_StringCchCopyA' : undeclared identifier "

Tools->Options->Show directories
1. platform sdk include
2. dxsdk8.1 include
3. msxml4.0 include
4. visual studio include

Thank you for the help,
feel

 

Without a code sample it is really hard to speculate what is happening.

All what I can find is that in PlatformSDK\include\strsafe.h you will find:
#define strcpy      strcpy_instead_use_StringCbCopyA_or_StringCchCopyA;

May be it is the order you are including the header files or the mix.

Try generating a proprocessed version of he file reporting the errors and take a look at this file. You can use the /P compiler option to generate such a preprocessed version.

Hope this helps!

Thanks,
  Ayman Shoukry
  VC++ Team
 
 
四:
Start VS6 and go to Tools/Options/Directories. Make sure that the folder order is as indicated below. If any folder is not there, you need to add it. This is the order in which they need to appear.

Include files:

DirectX include folder
MS Platform SDK include folder
MS VC98 include folder
MS VC98 MFC include folder
MS VC98 ATL include folder

Library files:

DirectX lib folder
MS VC98 lib folder
MS VC98 MFC lib folder
Couple of things to note:

Keith states on his site that the April 2005 SDK works with VS6; which is why I decided to try it for this legacy app which I still had using the October 2004 SDK. I've sent him email letting him know that it doesn't quite work without the tinkering indicated above.

DirectShow is now in the MS Platform SDK. If you had modules which were based off any of its samples, you will have to modify them to work. e.g. this legacy app I was trying to build, was using an AVI player based on the original cutscene.cpp sample program included with DirectShow. Now that file has been moved into the \Microsoft Platform SDK\Samples\Multimedia\DirectShow\Players\Cutscene folder. It has been modified to work with later DX and MS PSDK builds, so your legacy app won't work without revision. e.g. you will get linker errors like lstrcpy_instead_use_StringCbCopy_or_StringCchCopy or wsprintf_instead_use_StringCbPrintf_or_StringCchPrintf etc because the older versions of some DirectShow samples, did stuff like:

wsprintf(szTitle, TEXT("%s: \0", CUTSCENE_NAME);
_vsntprintf(szBuffer, NUMCHARS - 1, szFormat, pArgs);

which have now been changed to:

(void)StringCchPrintf(szTitle, NUMELMS(szTitle), TEXT("%s: \0", CUTSCENE_NAME);
(void)StringCchVPrintf(szBuffer, NUMCHARS - 1, szFormat, pArgs);

You will have to revise your DirectShow sources to match the changes in the new samples in order to get them to work. Thats what I had to do with that one DirectShow sample (cutscene.cpp) that my player was based on.

If you have been compiling a DX8.1 based source app with the DX9 SDK, they will no longer compile without further tinkering. e.g. the d3dx8.h file is gone. And no, replacing all calls to that header file with d3dx9.h won't work without further significant tinkering. You will have to port the app to DirectX9 SDK. Good luck with that if you didn't do it before. If someone knows a way around this and which I may not be aware of, please let me know.
http://www.itpub.net/thread-526568-1-1.html


你可能感兴趣的:(c,Microsoft,File,include,linker,preprocessor)