VS2005下的快疯了高手进来看

honghufuwei 2007-03-22 01:46:34
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(141) : error C2146: syntax error : missing ';' before identifier 'HwndMSWheel'
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(141) : error C2433: 'HWND' : 'inline' not permitted on data declarations
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(141) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(142) : error C2065: 'PUINT' : undeclared identifier
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(142) : error C2146: syntax error : missing ')' before identifier 'puiMsh_MsgMouseWheel'
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(142) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(147) : error C2059: syntax error : ')'
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(148) : error C2143: syntax error : missing ';' before '{'
d:\program files\microsoft visual studio 8\vc\platformsdk\include\zmouse.h(148) : error C2447: '{' : missing function header (old-style formal list?)
d:\program files\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT'
d:\program files\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier
d:\program files\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
d:\program files\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\program files\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation
生成日志保存在“file://d:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\1\1\Debug\BuildLo

都是怎么回事啊,什么错误,怎么改.
...全文
972 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
conil123 2007-04-03
  • 打赏
  • 举报
回复
没有注释,想看懂都很难~恐怕连作者也不知道写了什么东西
mgphuang 2007-04-03
  • 打赏
  • 举报
回复
看看你的头文件的引用顺序。
  • 打赏
  • 举报
回复
本来还想看一下,但是看到那个150行的函数就决定放弃了。
  • 打赏
  • 举报
回复
发送数据 Sendmessage? 是send
ReceiveMessage? 是recv
honghufuwei 2007-03-22
  • 打赏
  • 举报
回复
还有CFile.open(name,Cfile::modecreat)
为什么生的文件名字是乱码呢?
honghufuwei 2007-03-22
  • 打赏
  • 举报
回复
int _tmain(int argc, _TCHAR* argv[])
{ sendfile();
return 0;
}

void sendfile()
{
char *data;
bool bRet;
std::ifstream file1;

WSADATA wsaData;
SOCKET sock=NULL;
sockaddr_in localAddr,clientAddr;
int sizeAddr=sizeof(sockaddr);
if(WSAStartup(MAKEWORD( 2, 2 ), &wsaData)!=0)
{
AfxMessageBox(_T("Socket init error"));
//return sock;
}
sock=socket(AF_INET, SOCK_STREAM,0);
localAddr.sin_addr.s_addr=htonl(INADDR_ANY);
localAddr.sin_family=AF_INET;
localAddr.sin_port=htons(SERVER_LISTEN_PORT);

if(bind(sock,(const struct sockaddr*)& localAddr,sizeAddr)==SOCKET_ERROR)
{
AfxMessageBox(_T("Bind error!"));
closesocket(sock);
WSACleanup();
}

AfxMessageBox(_T("Listening at port "));
listen(sock,1);


SOCKET clientSock;
if((clientSock=accept(sock,(struct sockaddr*)&clientAddr,&sizeAddr))==INVALID_SOCKET)

{
AfxMessageBox(_T( "Accept error"));
closesocket(sock);
WSACleanup();
}
FILE *fp;
if((fp=fopen("D:\\f.txt","r"))==NULL)
{
exit(1);
}
char *data1 ;
data1=new char[255];
if( fgets( data1, 100, fp ) == NULL)
AfxMessageBox(_T( "fgets error\n" ));
else
{



fclose(fp);
int l=strlen(data1);
data1[l-1]='\0';
char *data2=new char[255];
int k=0;
while(data1[k]!='\0')
{
data2[k]=data1[k];
k++;
}
data2[k]='\0';
file1.open(data2,std::ios::binary);
if(!file1.is_open())
{
AfxMessageBox(_T("data2文件没打开"));

}

char sDrive[_MAX_DRIVE];
char sDir[_MAX_DIR];
char sFname[_MAX_FNAME];
char sExt[_MAX_EXT];
assert(data2);
_splitpath_s(data2, sDrive, sDir, sFname, sExt);
strcat_s(sFname,sExt);
int length=strlen(sFname);
Sendmessage(clientSock,(const char*)&length,sizeof(int));
Sendmessage(clientSock,sFname,length);
length=file_size(data2);
long seek_len;
long r;
Sendmessage(clientSock,(const char*)&r,sizeof(long));// 先发送文件的尺寸给接收方
if(ReceiveMessage(clientSock,(char *)&seek_len,sizeof(long)))
AfxMessageBox(_T("以传送文件的大小:"));
AfxMessageBox(_T("开始发文件"));
length-=seek_len;
if(length<=0)
AfxMessageBox(_T("====服务器传送的文件在客户端已存在且传送完毕===="));
else //续传文件块
{
cout<<"====文件还有"<<length<<"未传完继续传送===="<<endl;
cout<<"正在发送文件......"<<endl;
file1.seekg(seek_len);
//cout<<"*"<<length<<"*"<<endl;
int i=length/SEND_SIZE;//对文件进行分段
Sendmessage(clientSock,(const char*)&i,sizeof(int));
long len_size=0;
for(int j=1;j<=i;j++)
{
bRet=TRUE;
data= new char[SEND_SIZE];
file1.read(data,SEND_SIZE);
bRet=Sendmessage(clientSock,data,SEND_SIZE);
delete[] data;
if(bRet)
{
//cout<<"Success sending file!"<<j<<endl;
//file.seekg(j*SEND_SIZE,std::ios::beg);
len_size+=SEND_SIZE;
}
else
{
cout<<"Failure sending file!"<<endl;
break;
}
}

if(len_size<length)
{
//file.seekg(length3);
long len=length-len_size;
data =new char [len];
file1.read(data,len);
if(Sendmessage(clientSock,data,len))
cout<<" ====文件全部传输完毕==== "<<endl;
// printf("clientip:%s",inet_ntoa(name.sin_addr));
delete[] data;
}

}

file.close();
closesocket(clientSock);




closesocket(sock);
}
}

long file_size(char *filename)
{
long length;

std::ifstream file;
char sDrive[_MAX_DRIVE];
char sDir[_MAX_DIR];
char sFname[_MAX_FNAME];
char sExt[_MAX_EXT];

assert(filename);

_splitpath_s(filename, sDrive, sDir, sFname, sExt);
//printf("路经是:%s",sDir);
strcat_s(sFname,sExt);
file.open(filename,ios::binary);
if(file.fail())
{
cerr<<"Fail opening file 文件不存在,从新发送"<<filename<<endl;
return 0;
}
file.seekg(0,std::ios::end);
length=file.tellg();
file.seekg(0,std::ios::beg);
file.close();
return length;
}
  • 打赏
  • 举报
回复
代码呢?
不想低调 2007-03-22
  • 打赏
  • 举报
回复
主要部分的代码贴出来啊
honghufuwei 2007-03-22
  • 打赏
  • 举报
回复
在线等~!要的是速度

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧