• precompiled header madness
    4 replies, posted
I'm working in a simple 2d game engine, which is mean to be compiled as a dll the problem is that Visual Studio asks me to add #include "StdAfx.h" in one of the headers that will be shared with the host process, and it's pretty weird, because I exported in the same way another part of the engine without any problem. here is the code [CODE] //IRenderWindow.h #pragma once #include "export.h" class IRenderWindow { public: virtual void Resize(int w, int h) = 0; virtual void Move(int x, int y) = 0; virtual void SetTitle(wchar_t *title) = 0; //virtual HDC GetDC() = 0; //virtual HWND GetHnd() = 0; }; IRenderWindow PLASTIK2D_API *CreateRenderWindow(wchar_t *classname, wchar_t *title, int width, int height, void * icon, void * cursor, bool resizeable, bool maxButton); IRenderWindow PLASTIK2D_API *CreateRenderWindow( wchar_t *title, int width, int height, bool resizeable, bool maxButton);[/CODE] and the visual studio error [QUOTE]1>c:\documents and settings\equipo\mis documentos\visual studio 2010\projects\48+\plastik2d\irenderwindow.h(23): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?[/QUOTE] while this one works fine [CODE] //IProfiler.h #pragma once #include "export.h" class IProfiler { public: virtual void ReportMemory() =0; virtual void ReportThreads() =0; }; IProfiler PLASTIK2D_API *getProfiler();[/CODE] thanks in advice
Just don't use precompiled headers?
[QUOTE=neos300;36710537]Just don't use precompiled headers?[/QUOTE] for and against about precompiled headers? (ok, against this issue, but remove precompiled headers would be the easy sollution, i want at least know why or why not use them and why is this failing!!! )
You will almost certainely never use the features of them, and it's limited to windows only. Precompiled headers cause all sorts of problems (like this one) that have cryptic/difficult solutions, best not to use them IMO.
[QUOTE=neos300;36711069]You will almost certainely never use the features of them, and it's limited to windows only. Precompiled headers cause all sorts of problems (like this one) that have cryptic/difficult solutions, best not to use them IMO.[/QUOTE] Not true, GCC supports them as well. I do agree that you shouldn't use them unless you have a very good reason (i.e. large template libraries).
Sorry, you need to Log In to post a reply to this thread.