Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Removing stdafx.h

Removing stdafx.h

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cedric Moonen
    wrote on last edited by
    #1

    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

    R D 2 Replies Last reply
    0
    • C Cedric Moonen

      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

      R Offline
      R Offline
      Robert Kuster
      wrote on last edited by
      #2

      > 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

      C 1 Reply Last reply
      0
      • R Robert Kuster

        > 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

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • C Cedric Moonen

          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

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups