实现WORD文档的自动打印- -| 回首页 | 2004年索引 | - -数据库的连接串(中文)

VC编译常见错误- -

                                      

1、Fatal Error C1010
unexpected end of file while looking for precompiled header directive
这一般是由于使用了参数/Yu"stdafx.h",意思是在每个文件中都应该使用#include来包含这个头文件。一般改正,就是在每个。CPP文件中包含这个文件就可以。
2、LNK2001 on __beginthreadex and __endthreadex
这是一个非常常见的链接错误。原因是由于在VC3。0以后所有的MFC类都是线程安全的,在MFC类库中使用了Thread Local Storage (TLS)提供预处理的数据。因此如果程序中包含了"stfafx.h"头文件或者使用了,MFC类库中的类就会使用MSVCRTx0.DLL 来进行链接。改正方法如下:
On Visual C 2.x, 5.0, and 6.0: 
     Select the Project menu, and then continue Steps 2 through 5 below.
On Visual C 4.x: 
      Select the Build menu.
      Select the Settings... option.
     Select the C/C++ tab.
     Select Code Generation on the Category list box.
     Finally, make a selection other than Single-Threaded on the Use Run Time Library list box.
      如果使用了"Multithreaded using DLL"方式还要求在预处理符号中加上_AFXDLL 符号.
      还在LIBC。LIB是C Runtime的静态链接库。
    MSVCRTx0.DLL 是C Runtime的动态链接库。
    如果程序中包含了任何MFC代码,或者编译使用了/MT选项,都要求使用多线程库。
    为什么在程序中包含了"StdAfx.h"文件也会出现这个连接错误呢?是由于在"StdAfx.h"中使用了MFC类,并且重载了new等操作符,如果在程序中使用了NEW等就会出现链接错误。

1、Fatal Error C1010
unexpected end of file while looking for precompiled header directive
这一般是由于使用了参数/Yu"stdafx.h",意思是在每个文件中都应该使用#include来包含这个头文件。一般改正,就是在每个。CPP文件中包含这个文件就可以。
2、LNK2001 on __beginthreadex and __endthreadex
这是一个非常常见的链接错误。原因是由于在VC3。0以后所有的MFC类都是线程安全的,在MFC类库中使用了Thread Local Storage (TLS)提供预处理的数据。因此如果程序中包含了"stfafx.h"头文件或者使用了,MFC类库中的类就会使用MSVCRTx0.DLL 来进行链接。改正方法如下:
On Visual C 2.x, 5.0, and 6.0: 
     Select the Project menu, and then continue Steps 2 through 5 below.
On Visual C 4.x: 
      Select the Build menu.
      Select the Settings... option.
     Select the C/C++ tab.
     Select Code Generation on the Category list box.
     Finally, make a selection other than Single-Threaded on the Use Run Time Library list box.
      如果使用了"Multithreaded using DLL"方式还要求在预处理符号中加上_AFXDLL 符号.
      还在LIBC。LIB是C Runtime的静态链接库。
    MSVCRTx0.DLL 是C Runtime的动态链接库。
    如果程序中包含了任何MFC代码,或者编译使用了/MT选项,都要求使用多线程库。
    为什么在程序中包含了"StdAfx.h"文件也会出现这个连接错误呢?是由于在"StdAfx.h"中使用了MFC类,并且重载了new等操作符,如果在程序中使用了NEW等就会出现链接错误。

- 作者: guangjui 2004年11月10日, 星期三 13:47 加入博采

Trackback

你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=221785

回复

评论内容: