错误C2061:语法错误:标识符'CString'和错误C2065:'CString':未声明的标识符 [英] error C2061: syntax error : identifier 'CString' and error C2065: 'CString' : undeclared identifier

查看:676
本文介绍了错误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]

推荐答案

我认为您在项目中未使用MFC.

一种解决方案是使用
I think you are not using MFC in your project.

One solution is use
#include <atlstr.h>


两种方式:
Two ways:
#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]


我发现以下文章表明您应该能够在VC 6中使用CString(与假设相反)在我对OriginalGriffs解决方案的最初评论中):
将MFC的CString类添加到不依赖MFC的ATL中

该文章下面的一些注释涉及在VC 6中使用它的问题.也许其中一些注释会有所帮助.
I''ve found the following article that indicates you should be able to use CString in VC 6 (contrary to the assumption in my initial comment within OriginalGriffs solution):
Add MFC''s CString class to ATL with No MFC Dependencies

Some of the comments below that article deal with using it in VC 6, maybe some of that can be of help.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆