针对error C1001的处理方法

在整理机器时发现了一篇一年多以前写的总结。估计当时可能是想放到Blog中,不知道为何没有上传。还好,没有因为更换机器,格式硬盘而导致丢失。

既然找到了,就发出来吧。记录自己点滴的同时,也方便他人。希望能个其他朋友予启示。

 

最近在编译一个VC6.0工程(开发环:WinXP+VS6.0),在加入预编译头后出了下面的编译错误提示:
fatal error C1001: INTERNAL COMPILER ERROR(compiler file 'msc1.cpp', line 1794)
工程中的cpp文件编译都没有问题(除了预编译头对应cpp文件),很是奇怪,于是在网上找了一下,找到下面一解决法:

VC6.0的一个编译错误的解决

window98下使用vc6.0,如果预编译头文件(stdafx.h)中包含了模板文件,比如atl文件编译器会报错
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)

造成这种问题的原因是编译器分配的内存超了限制。
解决的法有
1.
给编译器增大内存限制。在project(工程)->setting置)->c/c++project option(工程选项)中,添加/Zm#nn选项#nn是一个数字,取最大2000。默认为100。但是这种方法好像没有什
2.
将模板类头文件从stdafx.h中移出;
3.
不使用预编译头文件。project->setting->c/c++选择所有的.cpp文件,都使用不使用预编译头文件选项。缺点是编译候很慢。

http://www.ieasy.org/yuzuo/archives/2005_07.html

有一个英文的:

I see that while compiling ITEL.CPP it is trying and failing to open
Debug/IODIARY.PCH. I also see that there is no IODIARY.CPP. Exactly how is
IODIARY.PCH supposed to be created?

Turn off precompiled headers for all files in the project, and rebuild. If
the build still fails, then... uh-oh..

Modify the project to use the default STDAFX.CPP/STDAFX.H method of using
PCH. Then, add an empty file STDAFX.H and an empty file STDAFX.CPP to the
project. Then, for each .CPP file, add as the first line #include
"stdafx.h" . Then compile. This should work. If it does not... uh-oh.

In order for pre-compiled headers to work properly each .CPP must have as
its first #include statement the name of the one .H (such as STDAFX.H) that
includes all the "actual" .H's (
windows.h, stdio.h, etc.) that should be
included by ALL .CPPs.

That is the important part. You don't usually want EVERYsingle .H that is
included in ANY .CPP in the project to be in STDAFX.H -- you do normally
want windows.h, because it is the big one that can include a lot and is
usually included in every .CPP. Putting just windows.h in stdafx.h (and
removing it from all the .CPPs) can speed up the build tremendously.

 

实用了上述的13方法,但是都没能解决这个问题。后来安装SP6后问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值