基于对话框的MFC程序,类CUser的头文件如下:
// Users.h: interface for the CUsers class.
//
//////////////////////////////////////////////////////////////////////#if !defined(AFX_USERS_H__6DF2B22F_8C78_4C8D_BEFD_D8C06449DCF2__INCLUDED_)
#define AFX_USERS_H__6DF2B22F_8C78_4C8D_BEFD_D8C06449DCF2__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000class CUsers  
{
public:
void SetUser_type(int iUser_type);
int GetUser_type();
void sql_update(CString cUserName);
void sql_insert();
void sql_delete(CString cUserName);
void SetUserName(CString cUserName);
void SetPwd(CString cPwd);
int HaveName(CString cUserName);
CString GetUserName();
CString GetPwd();
void GetData(CString cUserName); CUsers();
virtual ~CUsers();private:
int User_type;
CString Pwd;
CString UserName;
};#endif // !defined(AFX_USERS_H__6DF2B22F_8C78_4C8D_BEFD_D8C06449DCF2__INCLUDED_)
错误如下:
--------------------Configuration: HospitalMan - Win32 Debug--------------------
Compiling...
StdAfx.cpp
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(17) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(19) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(20) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(21) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(22) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(23) : error C2146: syntax error : missing ';' before identifier 'GetUserName'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(23) : error C2501: 'CString' : missing storage-class or type specifiers
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(24) : error C2146: syntax error : missing ';' before identifier 'GetPwd'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(24) : error C2501: 'CString' : missing storage-class or type specifiers
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(25) : error C2061: syntax error : identifier 'CString'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(32) : error C2146: syntax error : missing ';' before identifier 'Pwd'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(32) : error C2501: 'CString' : missing storage-class or type specifiers
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(32) : error C2501: 'Pwd' : missing storage-class or type specifiers
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(33) : error C2146: syntax error : missing ';' before identifier 'UserName'
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(33) : error C2501: 'CString' : missing storage-class or type specifiers
f:\学习工具\vc++\msdev98\myprojects\hospitalman\users.h(33) : error C2501: 'UserName' : missing storage-class or type specifiers
Error executing cl.exe.HospitalMan.exe - 16 error(s), 0 warning(s)