Results 1 to 7 of 7

Thread: Basic question

  1. #1

    Thread Starter
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Basic question

    what is the usage of this header file stdafx.h? As it come along with the project created with the VS wizards.

  2. #2
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    It contains the most common used headers. (Why don't you open that header and read its comments?)

    If you are adding your own CPP to your own VC project and you have troubles compiling(assuming your hand coded cpp uses MFC), then include stdafx.h at the very top of source before any headers.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I always remove all the stdafx junk if it exists in a project. I've never found a use for it, personally.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    If it is a console project, you may remove it. But for other project types it is a no-no.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by transcendental
    If it is a console project, you may remove it. But for other project types it is a no-no.
    Like what other types? I never have it in a WIN32 application either. Those are the only two types of projects I've done, and I've never used it.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6
    Hyperactive Member
    Join Date
    Sep 2001
    Posts
    396
    It is safe to remove, if you find that it doesn't include any other headers. The 'other types' is MFC.

  7. #7

    Thread Starter
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Originally posted by transcendental
    It contains the most common used headers. (Why don't you open that header and read its comments?)
    I know it and did it too, perhaps i do not make my question clear. What i mean this those code like below:

    Code:
    #if !defined(AFX_STDAFX_H__1F8D8CC3_BD47_410A_819B_68B19F50A6CC__INCLUDED_)
    #define AFX_STDAFX_H__1F8D8CC3_BD47_410A_819B_68B19F50A6CC__INCLUDED_
    Also, if I delete this file from the project workspace generated by the VC++ wizard, I need to remove the following command from the project option too:

    "stdafx.h"


    Originally posted by The Hobo
    I never have it in a WIN32 application either. Those are the only two types of projects I've done, and I've never used it.
    me too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width