本文介绍了错误C2061:语法错误:标识符'CString'和错误C2065:'CString':未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


能否请您告诉我必须包含哪个头文件才能在VC ++ 6.0中使用CString? Win32 DLL.我在网上寻找了东西,但找不到.一个建议使用AFX.h,另一个建议我们#include< stdafx.h>但我的项目已经有#include< stdafx.h>并且它还具有#include< windows.h> ;,我也尝试了#include"fstream.h";但是我仍然得到编译错误为

Hi,
Could you please, any one tell me which header file I have to include being able to use CString in VC++ 6.0? Win32 DLL. I have looking on the net and I can''t find one that works. One suggests to use AFX.h, another suggest us #include <stdafx.h> but my project already have #include <stdafx.h> and it also having #include <windows.h>, and I also tried #include "fstream.h" ; However still I am getting compilation error as

error C2061: syntax error : identifier 'CString'
error C2065: 'CString' : undeclared identifier


谢谢.

[edit]删除了伪代码块-OriginalGriff [/edit]


Thank you.

[edit]Spurious code blocks removed - OriginalGriff[/edit]

推荐答案

#include <atlstr.h>


#include <string.h>




Or

#include <cstring>


后来将CString作为Std名称空间的一部分.

[edit]忘记转换<和>到HTML安全...:O-OriginalGriff [/edit]


The later incudes CString as part of the Std namespace.

[edit]Forgot to convert < and > to HTML safe... :O - OriginalGriff[/edit]



这篇关于错误C2061:语法错误:标识符'CString'和错误C2065:'CString':未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 13:23