Thread: ??

  1. #1
    Registered User
    Join Date
    Jan 2006


    Why is my c++ program always asking to type
    #include "stdafx.h" in the precompiled header??

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you turn off precompiled headers in the IDE (compiler->settings), then it should stop.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    I must admit that I'm not very familiar with term "Precompiled headers".
    Can you explain it with a little more detail Salem?
    Gotta love the "please fix this for me, but I'm not going to tell you which functions we're allowed to use" posts.
    It's like teaching people to walk by first breaking their legs - muppet teachers! - Salem

  4. #4
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    If you are using Microsift Visual C++ latest versions, they need a pre-compileed header that contains functions and prototypes that work alongside the IDE you are using. If you create a program that uses muti-files, such as a large project, any files apart from header files you create, thus scource code files c.pp need the precompiled header in order for the compiler to understand certain aspects of the code. I do not know much more, but you could press F1 and go into the in depth help files and look that way.

  5. #5
    Registered User
    Join Date
    Jan 2005
    A pre-compiled header is used to speed up compile times by combining commonly used headers into a single header (stdafx.h) that is "pre-compiled" once instead of having the common headers processed every tie they are included in another source file.

    You don't need pre-compiled headers for small projects. If you do use them, you just have to add #include "stdafx.h" as the first include in all your source files. If you don't want to use them, then when you create your project in VC++, pick Win32 Console Application, and in the wizard make sure to check Empty Project. You might have to switch to a different page to find that option. If the project is already created, you'll have to find the option in the project settings or project properties.

Popular pages Recent additions subscribe to a feed