在查找预编译头时跳过 [英] skipped when looking for precompiled header

查看:394
本文介绍了在查找预编译头时跳过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以有些原因,我的.cpp文件缺少它的头文件。但我不包括头文件在其他地方。我刚刚开始,所以我检查了所有的文件



enginuity.h



  #ifndef _ENGINE_ 
#define _ENGINE_

class Enginuity
{

public:
void InitWindow();

};



enginuity.cpp



  #includeEnginuity.h


void Enginuity :: InitWindow()
{

}



main.cpp



  #includestdafx.h
#includeGameProject1.h

#define MAX_LOADSTRING 100

//全局变量:
HINSTANCE hInst; // current instance
TCHAR szTitle [MAX_LOADSTRING]; //标题栏文字
TCHAR szWindowClass [MAX_LOADSTRING]; //主窗口类名称

//此代码模块中包含的函数的转发声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE,int);
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
INT_PTR CALLBACK关于(HWND,UINT,WPARAM,LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{

.....
#endif

不知道发生了什么。我得到的错误是



<预类=郎无prettyprint-覆盖> 1 GT; C:\users\\\
umerical25\desktop\\ \\intro todirectx\gameproject\gameproject1\gameproject1\enginuity.cpp(1):警告C4627:'#包括Enginuity.h':寻找预编译头使用
1 GT时跳过;添加指令的stdafx.h或重新生成预编译的头
1 GT; C:\users\\\
umerical25\desktop\intro todirectx\gameproject\gameproject1\gameproject1\enginuity.cpp(8) :致命错误C1010:意外的文件结尾,而寻找预编译头。你忘了添加#includestdafx.h'到你的来源?


解决方案

你看了错误信息?




致命错误C1010:意外的文件结尾,而寻找预编译头。你忘了加上#包括stdafx.h中'你的来源?




我没有看到 #includestdafx.h在enginuity.cpp中。 ;)如果你使用预编译的头,你需要在的每个的源(的.cpp)文件


预编译头。

So some reason, my .cpp file is missing it's header file. But I am not including the header file anywhere else. I just started so I checked all the files I made

enginuity.h

#ifndef _ENGINE_
#define _ENGINE_

class Enginuity
{

public:
    void InitWindow();

};

enginuity.cpp

#include "Enginuity.h"


void Enginuity::InitWindow()
{

}

main.cpp

#include "stdafx.h"
#include "GameProject1.h"

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                                // current instance
TCHAR szTitle[MAX_LOADSTRING];                  // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];            // the main window class name

// Forward declarations of functions included in this code module:
ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{

code.....
#endif

dont know what's going on. The error I get is

1>c:\users\numerical25\desktop\intro todirectx\gameproject\gameproject1\gameproject1\enginuity.cpp(1) : warning C4627: '#include "Enginuity.h"': skipped when looking for precompiled header use
1>        Add directive to 'stdafx.h' or rebuild precompiled header
1>c:\users\numerical25\desktop\intro todirectx\gameproject\gameproject1\gameproject1\enginuity.cpp(8) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

解决方案

Did you read the error message?

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

I don't see an #include "stdafx.h" in enginuity.cpp. ;) If you're using precompiled headers, you need to include the precompiled header in every source (.cpp) file.

这篇关于在查找预编译头时跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆