C++学习,两个小的语法错误-network-programming

1.bool CServerSocket::initSocket(const char* ip=NULL,const UINT &port);//会出现默认参数为2的错误

解决方案:

//C++语法规定:只要有一个默认参数,那么该参数后面的所有参数都必须指定默认值
//所以将initSocket的两个参数的位置调换了一下。

bool CServerSocket::initSocket(const UINT &port,const char* ip=NULL);//正确

2.出现错误:WINDOWS.H already included. MFC apps must not #include <windows.h> 。。。

解决方案:

将每个文件中的#include"stdafx.h"应放在各头文件的最前面。

 

posted @ 2017-06-05 21:10  林木子  阅读(163)  评论(0编辑  收藏  举报