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
#ifndef _ENGINE_
#define _ENGINE_
class Enginuity
{
public:
void InitWindow();
};
#include "Enginuity.h"
void Enginuity::InitWindow()
{
}
#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?
My issue was resolved when i mentioned #include "stdafx.h" on the top of all includes.
I just experienced this error when including stdafx.h in a cpp file located in a parent folder above where stdafx.h is.
#include "subfolder\stdafx.h"
causes the compile error. Changing it to:
#include "stdafx.h"
fixes the compile error, but then intellisense freaks out.
The "fix" for intellisense, according to someone at Microsoft here, is to add "$(ProjectDir)" (or wherever the stdafx.h is) to the list of directories under Project->Properties->Configuration Propertes->C/C++->General->Additional Include Directories.
I've verified this works in Visual Studio 2012. Should work in 2010 as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With