#include "stdafx.h"#include <afxtempl.h>
#include <stdio.h>int main(int argc, char* argv[])
{
CList<int,int> List;
int li = 100,liRet = 0;
List.AddTail(li);
liRet = List.GetTail();
printf("%d",liRet);
return 0;
}就这么简单的几句竟然出现了连接出错,那位dx帮帮忙吧!
错误如下:
afxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex

解决方案 »

  1.   

    设置project:c/c++ ==> code generation ==> use run-time library: multithreaded dll
      

  2.   

    刚才我的系统发生一点混乱,抱歉!
    建义楼主使用STL,在控制台工程中使用MFC库的话有点麻烦!
      

  3.   

    to flyelf(空谷清音) 
    多谢!搞定了!
    我还有个问题。怎么上面那个代码加上#include <windows.h>就报
    e:\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>
    怎么有#include <afxtempl.h>就不能#include <windows.h>
      

  4.   

    应设置
    project:c/c++ ==> code generation ==> use run-time library: debug multithreaded 
    就可以了,我试过了
      

  5.   

    因为#include <afxtempl.h>里已经包函了windows.h的头文件
      

  6.   

    #include "stdafx.h"#include <afxtempl.h>
    #include <stdio.h>int main(int argc, char* argv[])
    {
    CList<int*,int*> List;
    int * li = new int[1];
    int * liRet = new int[1];
    *li = 100;
    List.AddTail(li);
    liRet = List.GetTail();
    printf("%d",*liRet);
    *li = 200;
    printf("%d",*liRet);
    Sleep(3000);
    delete li;
    delete liRet;
    return 0;
    }改成上面的代码,就晕了,这是什么错呀
    afxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
    nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
    Debug/2.exe : fatal error LNK1169: one or more multiply defined symbols found
      

  7.   

    在工程设置中,加入using mfc ..... 应该编译就没有问题了
    我看应该是你用到了mfc的东西,而使用这个选项所以mfc的库并没有包含进来的原因