做练习时,我在visual studio.net的新建项目中选择win32项目,然后我添加了自己的两个文件:MyClass.h Myclass.cpp,然后编译就出现了...MyClass.cpp(38) fatal error C1010: 查找预编译头指令时遇到意外的文件结束我以为是我的两个文件写错了什么,所以就把文件里的所有代码全都注释,再编译,错识还是上面的,我不是很理解这个stdafx.h stdafx.cpp这两个用来邓编译的和我的MyClass.cpp有什么关系,我添加的文件怎么和预编译拉上了关系?
MyClass.cpp里// ===========================================================
// MyClass.cpp
//
#include "afxwin.h"
#include "MyClass.h"
MyClassApp theApp;
...
MyClass.cpp里// ===========================================================
// MyClass.cpp
//
#include "afxwin.h"
#include "MyClass.h"
MyClassApp theApp;
...
解决方案 »
- 老生长谈的问题 :调用DLL, hLib总是返回NULL?
- 如何获取到MessageBox里德文字信息?
- 在VS2005中,用VC++2005 写的东西, 用上 CLR 才是 .net, 这种想法对不对?
- SetWindowsHookEx 出错
- 为什么在DLL中,AVICap类的创建窗口capCreateCaptureWindow函数,没有生成句柄,程序是编译OK的,问题在哪?
- 菜鸟求助:请高手给出一个快速检索的算法,急……
- 在线等,非常紧急的问题,Amdinistrator帐户在登陆窗口上不见了,如何恢复?
- 非模式对话如何位于所有窗口上面?
- 请问:模版类如何继承???
- sizeof问题
- SOS,谁有人事管理系统源代码??
- 请问c语言里是否有inportb,outportb这两个函数,他们的功能是什么?
// MyClass.cpp
//
#include "stdafx.h" //try this
#include "afxwin.h"
#include "MyClass.h"
MyClassApp theApp;
afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>stdafx.h里面是
// stdafx.h : 标准系统包含文件的包含文件,
// 或是常用但不常更改的项目特定的包含文件
//#pragma once#define WIN32_LEAN_AND_MEAN // 从 Windows 头中排除极少使用的资料
// Windows 头文件:
#include <windows.h>
// C 运行时头文件
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>// TODO: 在此处引用程序要求的附加头
ms搞pch不是为了做拦路虎的吧。
//#include <windows.h >
#include "afxwin.h "
否则每次都那么长时间,会疯的~在VC6.0你新建一个Win32,只要不是空白的工程就行~
看看它的预编译文件和头文件~然后你试试7.0行不行~
我没用过~