小弟出学vc,即捧了一本《mfc windows编程2》,即照着作者手工练习,但是每次都会在连接时出现四个错误,即使我拷贝粘贴也一样,
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/wind.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
我是像作者那样,直接作*.c和*.cpp,请问是怎么回事,是不是我的方式不对。高手勿笑,我对vc是一点不了解。

解决方案 »

  1.   

    在cpp的头中增加
    #pragma comment(lib, "MSVCRT.LIB")
    或者在
    Project\settings\link中包含该文件也试试包含LIBCMT.LIB
      

  2.   

    agree with the second floor
      

  3.   

    project->setting->link->project options -> /subsystem:windows这里将原来的console改成windows即可
      

  4.   

    大哥,出现这问题了
    LINK : warning LNK4098: defaultlib "MSVCRT.LIB" conflicts with use of other libs; use /NODEFAULTLIB:library
    LINK : warning LNK4098: defaultlib "LIBCMT.LIB" conflicts with use of other libs; use /NODEFAULTLIB:library
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Hello.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
      

  5.   


    我怕了,用了isdong大哥的方法,又出现这问题
    Linking...
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    Debug/Hello.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    然后把alfwolf和isdong综合起来用,可以运行,不过有警告
    Linking...
    LINK : warning LNK4098: defaultlib "MSVCRT.LIB" conflicts with use of other libs; use /NODEFAULTLIB:library
    LINK : warning LNK4098: defaultlib "LIBCMT.LIB" conflicts with use of other libs; use /NODEFAULTLIB:library
    我的头大了