VS2008 新建的win32 DLL 工程,加了一个文件引用CAsyncSocket类后,编译总提示fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>。
以前是编译成功通过的,而且DLL也是可以运行的,后来不知道改动了什么东西,老是出现这个提示,现将整个工程上传。成功解决的加分+100元手机话费酬谢工程下载 http://download.csdn.net/detail/yhgfriend/6475189
重点在UDP.cpp文件
以前是编译成功通过的,而且DLL也是可以运行的,后来不知道改动了什么东西,老是出现这个提示,现将整个工程上传。成功解决的加分+100元手机话费酬谢工程下载 http://download.csdn.net/detail/yhgfriend/6475189
重点在UDP.cpp文件
#include "stdafx.h"
#include <stdio.h>
#include "MySocket.h"
#include <winsock2.h>#pragma comment(lib, "ws2_32.lib")
*********************************************************************
以下为MySocket.h文件全部*********************************************#include <Afxsock.h>
#if !defined(AFX_MYSOCKET_H__6113F2E0_C873_43EB_BFF1_14FF81B6AF9F__INCLUDED_)
#define AFX_MYSOCKET_H__6113F2E0_C873_43EB_BFF1_14FF81B6AF9F__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MySocket.h : header file
///////////////////////////////////////////////////////////////////////////////
// MySocket command targetclass MySocket : public CAsyncSocket
{
// Attributes
public:// Operations
public:
MySocket();
virtual ~MySocket();// Overrides
public:
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(MySocket)
public:
virtual void OnAccept(int nErrorCode);
virtual void OnReceive(int nErrorCode);
//}}AFX_VIRTUAL // Generated message map functions
//{{AFX_MSG(MySocket)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG// Implementation
protected:
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_MYSOCKET_H__6113F2E0_C873_43EB_BFF1_14FF81B6AF9F__INCLUDED_)