《深入浅出MFC》中源码编译为何出错?
最近在看《深入浅出MFC》,但是在编译随书的源码时却总是出错;例如第二章的Flow.cpp:
#include <iostream.h>
#include <string.h>
class CDemo
{
public:
CDemo(const char* str);
~CDemo();
private:
char name[20];
};
CDemo::CDemo(const char* str)
{
strncpy(name, str, 20);
cout << "Constructor called for " << name << '\n';
}
CDemo::~CDemo()
{
cout << "Destructor called for " << name << '\n';
}
void func()
{
CDemo LocalObjectInFunc("LocalObjectInFunc"); // in stack
static CDemo StaticObject("StaticObject"); // local static
CDemo* pHeapObjectInFunc = new CDemo("HeapObjectInFunc"); // in heap
cout << "Inside func" << endl;
}
CDemo GlobalObject("GlobalObject"); // global static
void main()
{
CDemo LocalObjectInMain("LocalObjectInMain"); // in stack
CDemo* pHeapObjectInMain = new CDemo("HeapObjectInMain"); // in heap
cout << "In main, before calling func\n";
func();
cout << "In main, after calling func\n";
}
出错提示是:
Compiling...
Flow.cpp
e:\深入浅出 mfc\dissect\flow.02\flow.cpp(27) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
Flow.exe - 1 error(s), 0 warning(s)
用MSDN介绍的方法也解决不了,网上介绍的rebuild all 以及禁用预编译头文件也不行,请问各位请是怎么回事?我用的是Win98+VC6.0创天中文版,救救我啊!
#include <iostream.h>
#include <string.h>
class CDemo
{
public:
CDemo(const char* str);
~CDemo();
private:
char name[20];
};
CDemo::CDemo(const char* str)
{
strncpy(name, str, 20);
cout << "Constructor called for " << name << '\n';
}
CDemo::~CDemo()
{
cout << "Destructor called for " << name << '\n';
}
void func()
{
CDemo LocalObjectInFunc("LocalObjectInFunc"); // in stack
static CDemo StaticObject("StaticObject"); // local static
CDemo* pHeapObjectInFunc = new CDemo("HeapObjectInFunc"); // in heap
cout << "Inside func" << endl;
}
CDemo GlobalObject("GlobalObject"); // global static
void main()
{
CDemo LocalObjectInMain("LocalObjectInMain"); // in stack
CDemo* pHeapObjectInMain = new CDemo("HeapObjectInMain"); // in heap
cout << "In main, before calling func\n";
func();
cout << "In main, after calling func\n";
}
出错提示是:
Compiling...
Flow.cpp
e:\深入浅出 mfc\dissect\flow.02\flow.cpp(27) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
Flow.exe - 1 error(s), 0 warning(s)
用MSDN介绍的方法也解决不了,网上介绍的rebuild all 以及禁用预编译头文件也不行,请问各位请是怎么回事?我用的是Win98+VC6.0创天中文版,救救我啊!
...全文
相关推荐
mfc深入浅出.pdf
微软开发的mfc,本书对其框架展开深入的研究,特别是窗口
EastDraw源码解析:从MFC矢量绘图到工程编译实战
桌面图形软件开发中,矢量绘图与位图编辑的本质区别在于保存几何定义而非像素点阵。MFC文档/视图架构分离数据与显示,通过OnDraw统一绘制图元,序列化机制保证图形对象可持久化恢复,坐标换算与命中测试则决定交互准确性。理解这些基础原理后,工程实践中常借助完整的参考实现加速落地,例如EastDraw这款经典矢量绘图软件的完整源代码包,既能作为可执行的轻量画图工具,也能拆解为图形对象模型、绘制循环、序列化与坐标换算等可复用模块。开发者可通过编译复现、运行验证与序列化往返测试,快速掌握图形编辑器从源码到可执行程序的
VC/MFC斗地主游戏源码
VC/MFC斗地主游戏源码,VC/MFC单机游戏源码下载
VC++ FTP客户端(MFC源码)
FTP客户端 支持输入密码 端口登陆,登陆成功后上传下载 在VC2008下编译成功
COptionTree VC2008 修改版 编译可通过
修改了COptionTree代码在VC2008环境下编译总是出现bug,GetTextExtentPoint32函数出错的问题,仅简单修改,编译可过,可运行,可进一步自己修改。


