我写了一个类class mysock:public Asynsocket
{类的申明;}
然后在类mydlg中引用class mydlg:public CDialog
{mysock m_sock;
}
我在mydlg前面包括了#include"mysock.h"
#include"stdafx.h"
但编译时,就是说mysock error C2501: 'mysock' : missing storage-class or type specifiers我将//mysock m_sock 注销后编译正常,百思不得其解.
{类的申明;}
然后在类mydlg中引用class mydlg:public CDialog
{mysock m_sock;
}
我在mydlg前面包括了#include"mysock.h"
#include"stdafx.h"
但编译时,就是说mysock error C2501: 'mysock' : missing storage-class or type specifiers我将//mysock m_sock 注销后编译正常,百思不得其解.
解决方案 »
- win32 application 如何创建子窗口
- libpcap ubuntu网络编程
- 能否SetWindowPos一个窗口的大小超出屏幕的分辨率?
- 读写注册表reg_multi_sz的问题
- 网络编程不知道为什么总是接收一半数据
- 关于使用重叠i/o发送消息的例子
- 请给点: MDI中怎样创建一个新的视图的程序让我学学。
- 请问如果只知道某个dll中的一个函数的函数名,参数,我想拦截(hook)这个函数,该怎么做?
- 求边缘检测算法
- MSMQ错误:未能为检测点保存 MQInSeq。没有检测点,消息队列不能可靠地继续。 HELP!!!在线等待!!!
- isapi筛选器主要做些什么工作?
- 关于文件操作,如何判断一个txt文件的内容是空的!(在线给分)
包在对话框的头文件中
是不是
要这样
#include"cmysock.h"
//以下是class的申明
#include"mysock.h"
#include"stdafx.h"//在sdtafx.h的头文件中已经包含了#include<afxsock.h>
class mydlg:Public CDialog
{public:
mysock m_sock;
}
编译后就出现如上所显示的错误,
但是//mysock m_sock后编译正常,也就是说#incliude"mysock.h" 头文件没错下面是用到的mysock类的申明
//head file mysock.h
#include'stdafx.h"//在该头文件中已有#include<afxsock.h>//以下是class的申明
class mysock:public CAsyncSocket
{
}
谢谢各位能来看看,我真有点晕了!!
#include"mysock.h"
check the #ifdef XXX / #define XXX / #endif in your header file.if you have two header file with same XXX? When you copy one header to create another header file. (guess).
class mysock;class mydlg:Public CDialog
{public:
mysock m_sock;
}再在mydlg类的cpp文件里加上:
#include "mysock.h"