Removing stdafx.h
-
Hello! I created a class (using the 'New Class' command). I want now to move the files (.h and .cpp) from this class in a library (so this class can be used in several programs). So I need to remove the #include "stdafx.h" and the #include "MyProg.h" files. The problem now is that when I compile, I get some errors ('BOOL' : missing storage-class or type specifiers and things like that). So I tried to include some header files, but nothing works (when I include afx.h, I get some other errors, the same for winbase.h, .....).:mad: So, what the hell must I do or include to have it work ????? Thanks for response
-
Hello! I created a class (using the 'New Class' command). I want now to move the files (.h and .cpp) from this class in a library (so this class can be used in several programs). So I need to remove the #include "stdafx.h" and the #include "MyProg.h" files. The problem now is that when I compile, I get some errors ('BOOL' : missing storage-class or type specifiers and things like that). So I tried to include some header files, but nothing works (when I include afx.h, I get some other errors, the same for winbase.h, .....).:mad: So, what the hell must I do or include to have it work ????? Thanks for response
> So, what the hell must I do or include to have it work ????? Well, first you'll need to turn off precompiled headers for you .cpp file. :) 1. Project -> Settings (or Alt+F7) -> C/C++ Tab -> Category: Precompiled Headers 2. On the left pane select your .cpp file. 3. Select "Not using precompiled headers" on the right pane. Of course, you'll still need to include the appropriate headers... Regards, RK
-
> So, what the hell must I do or include to have it work ????? Well, first you'll need to turn off precompiled headers for you .cpp file. :) 1. Project -> Settings (or Alt+F7) -> C/C++ Tab -> Category: Precompiled Headers 2. On the left pane select your .cpp file. 3. Select "Not using precompiled headers" on the right pane. Of course, you'll still need to include the appropriate headers... Regards, RK
It was already done ! But I don't know wich header to include... If I include "afxwin.h" for example (like in the stdafx.h file), I have a lot of errors (from within this file).... So I don't know what to do :confused: Thanks for your response
-
Hello! I created a class (using the 'New Class' command). I want now to move the files (.h and .cpp) from this class in a library (so this class can be used in several programs). So I need to remove the #include "stdafx.h" and the #include "MyProg.h" files. The problem now is that when I compile, I get some errors ('BOOL' : missing storage-class or type specifiers and things like that). So I tried to include some header files, but nothing works (when I include afx.h, I get some other errors, the same for winbase.h, .....).:mad: So, what the hell must I do or include to have it work ????? Thanks for response
Is your class autonomous, or does it rely on other classes/types/objects/etc? If the former, you will need to
#include
each file that stdafx.h would have otherwise included for you (e.g., windows.h).
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?