小编Dar*_*rós的帖子

错误C1010:查找预编译的标头时,文件意外结束。您是否忘记在源中添加“ #include“ stdafx.h””?

我有一个项目,最初是在Microsoft Visual C ++上开发的。NET,版本7.0.9466,并且效果很好。我尝试使用MS 2013运行我的项目,而当我尝试构建项目时,我遇到了这个错误提示:

错误C1010:查找预编译的标头时,文件意外结束。您是否忘记在源中添加“ #include“ stdafx.h””?

我已经做过的一些动作:

  • 我在PropertyPages-> C / C ++-> Precompiled Header的预编译头中选择了选项“ Use(/ Yu)”
  • 我将预编译的头文件设置为stdafx.h
  • 我放在#include "stdafx.h".cpp文件的开头
  • 我必须更改#include "stdafx.h"为,#include "../stdafx.h"因为我收到以下错误消息:

IntelliSense:无法打开源文件“ stdafx.h”

这是我出现此错误的.c​​pp文件

#include "../stdafx.h"
#include "timedmsgbox.h"

/////////////////////////////////////////////////////////////////////////
//
// CDlgTimedMessageBox
//
/////////////////////////////////////////////////////////////////////////

CMapPtrToPtr		CDlgTimedMessageBox::m_mapTimerIdToClassMe;
CCriticalSection	CDlgTimedMessageBox::m_sectMap;
extern BOOL AFXAPI AfxIsDescendant(HWND hWndParent, HWND hWndChild);

// the static one to call the messagebox with one line
UINT CDlgTimedMessageBox::TimedMessageBox(UINT flags, LPCTSTR ptszMessage, LPCTSTR ptszTitle, 
						DWORD dwTimeout, UINT dDefaultReturn,
						LPCTSTR …
Run Code Online (Sandbox Code Playgroud)

c++ header-files stdafx.h visual-studio visual-studio-2013

1
推荐指数
1
解决办法
6887
查看次数