请高手帮忙看看这个小程序的连接错误

使用VC++6.0,创建控制台应用程序,实现输出当前时间,代码如下
#include <iostream>
#include <afx.h>
using namespace std;
int main()
{
CTime ctTime=CTime::GetCurrentTime();
cout<<LPCTSTR(ctTime.Format("%Y-%m-%d %H:%M:%S"))<<endl;
return 0;
}
编译通过,连接时报错:
--------------------Configuration: Taxis - Win32 Debug--------------------
Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpd.lib(delop.obj)
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/Taxis.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Taxis.exe - 4 error(s), 1 warning(s)

你用到了CTIME类,需要引用mfc库
打开project->settings->general->microsoft foundation classes->
选use MFC in a static library
或选 use MFC in a shared DLL(需要把MFC的动态库放在system32文件夹下) .
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜