VC++编写连接FTP服务器程序,编译的时候报错
CFtptestView::CFtptestView(){CInternetSession*m_pInetsession;CFtpConnection*m_pFtpCon...
CFtptestView::CFtptestView()
{
CInternetSession *m_pInetsession;
CFtpConnection *m_pFtpConnection;
m_pInetsession=new CInternetsession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
m_pFtpConnection=m_pInetsession->GetFtpConnection("FTP.MICROSOFT.COM");
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
m_pFtpConnection=NULL;
}
}
我已经加了#include "afxinet.h"头文件了,可以还是报错,
:\FTP\ftptest\ftptestView.cpp(39) : error C2061: syntax error : identifier 'CInternetsession'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2143: syntax error : missing ';' before '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2319: 'try' must be followed by a compound statement. Missing '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2143: syntax error : missing ';' before '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2317: 'try' block starting on line '41' has no catch handlers
很多这样的缺少;错误 展开
{
CInternetSession *m_pInetsession;
CFtpConnection *m_pFtpConnection;
m_pInetsession=new CInternetsession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
m_pFtpConnection=m_pInetsession->GetFtpConnection("FTP.MICROSOFT.COM");
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
m_pFtpConnection=NULL;
}
}
我已经加了#include "afxinet.h"头文件了,可以还是报错,
:\FTP\ftptest\ftptestView.cpp(39) : error C2061: syntax error : identifier 'CInternetsession'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2143: syntax error : missing ';' before '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2319: 'try' must be followed by a compound statement. Missing '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2143: syntax error : missing ';' before '{'
D:\FTP\ftptest\ftptestView.cpp(41) : error C2317: 'try' block starting on line '41' has no catch handlers
很多这样的缺少;错误 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询