我是维c的初学者
在<<深入浅出MFC>>中有一个例子 // File : MFCCON.CPP
 // Author : J.J.Hou / Top Studio
 // Date : 1997.04.06
 // Goal : Fibonacci sequencee, less than 100
 // Build : cl /MT mfccon.cpp (/MT means Multithreading)
 #include <afx.h>
 #include <stdio.h>
 int main()
 {
 int lo, hi;
 CString str;
 CStdioFile fFibo;
 fFibo.Open("FIBO.DAT", CFile::modeWrite |
 CFile::modeCreate | CFile::typeText);
 str.Format("%s\n", "Fibonacci sequencee, less than 100 :");
 printf("%s", (LPCTSTR) str);
 fFibo.WriteString(str);
 lo = hi = 1;
 str.Format("%d\n", lo);
 printf("%s", (LPCTSTR) str);
 fFibo.WriteString(str);
 while (hi < 100)
 {
 str.Format("%d\n", hi);
 printf("%s", (LPCTSTR) str);
 fFibo.WriteString(str);
 hi = lo + hi;
 lo = hi - lo;
 }
 fFibo.Close();
 return 0;
 }
作者在最后提出
在MFC console 程式中一定要指定多緒版的C runtime 函式庫,
所以必須使用/MT 選項。如果不做這項設定,會出現這樣的聯結錯誤:
Microsoft (R) 32-Bit Incremental Linker Version 5.00.7022
Copyright (C) Microsoft Corp 1992-1997. All rights reserved.
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
mfccon.exe : fatal error LNK1120: 2 unresolved externals
这也是我产生的错误.我如何把这个问题解决,实在不行有谁能告诉我如何在DOS下编译生成exe文件

解决方案 »

  1.   

    设定多线程
    project/settings/c/c++
    选择MUTI....
    也就是倒数第二个
      

  2.   

    按照你的方法做了之後出現下列信息
    Compiling...
    console.cpp
    Linking...
    LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:libraryconsole.exe - 0 error(s), 1 warning(s)
    為什麼,幫幫忙
      

  3.   

    可能程序中混合连接了MT版和ST版、Debug版和Release版的库,造成了同名函数出现在多个LIB中。你的程序已经连接通过了,可以忽略它。