我的程序代码如下,是一个控制台程序!
#include <afx.h>
#include <afxwin.h>
#include <afxinet.h>
#include <stdio.h>// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GXCWinApp theApp;int main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return -1;
} // create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel)
// will be used. CInternetSession sess(_T("MyProgram/1.0")); CFtpConnection* pConnect = NULL; try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com")); // use a file find object to enumerate files
CFtpFileFind finder(pConnect); // start looping
BOOL bWorking = finder.FindFile(_T("*")); while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
} // if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect; return 0;
}
编译时出现如下错误:Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/222.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.不知道怎么回事,请高手指教、分析一下!谢了阿!
#include <afx.h>
#include <afxwin.h>
#include <afxinet.h>
#include <stdio.h>// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GXCWinApp theApp;int main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return -1;
} // create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel)
// will be used. CInternetSession sess(_T("MyProgram/1.0")); CFtpConnection* pConnect = NULL; try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com")); // use a file find object to enumerate files
CFtpFileFind finder(pConnect); // start looping
BOOL bWorking = finder.FindFile(_T("*")); while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
} // if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect; return 0;
}
编译时出现如下错误:Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/222.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.不知道怎么回事,请高手指教、分析一下!谢了阿!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货