Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

#include "stdafx.h "

DrakeDrake Posts: 5Member
Can anybody tell me what the stdafx.h header does. Or better what the headers ar doing this #include includes

thx

Comments

  • Eric TetzEric Tetz Posts: 2,141Member
    : Can anybody tell me what the stdafx.h header does. Or better what the headers ar doing this #include includes

    'stdafx' is just the default name for the 'precompiled header directive'. The headers that included in stdafx.h are compiled once, and the information is saved to disk. When a file includes stdafx.h, the compiler just loads the precompiled data instead of re-parsing all the headers. Typically, more times is spent parsing header files than actually compiling your code, so using precompiled headers can dramatically speed up your build times.

    All this information and more is in your online documentation.

    Cheers,
    Eric


  • AsmGuru62AsmGuru62 Posts: 6,519Member
    Guys,

    beware of the VC6.0 bug in that area: if you created an application using Wizard, you cannot add anything in the "stdafx.h" despite the comment in it that application should add its own header files here. If you add something the program does not compile!.. If you look closely to Project->Settings->Precompiler headers you will see that checkbox "Use precompiler header" is checked and the name being loaded is "stdafx.pch". Instead it should be "Automatically use/create" checkbox.

    Cheers!


  • Eric TetzEric Tetz Posts: 2,141Member
    : Guys,
    :
    : beware of the VC6.0 bug in that area: if you created an application using Wizard, you cannot add anything in the "stdafx.h" despite the comment in it that application should add its own header files here. If you add something the program does not compile!..

    Hmmm... I don't have that problem here.

    : If you look closely to Project->Settings->Precompiler headers you will see that checkbox "Use precompiler header" is checked and the name being loaded is "stdafx.pch". Instead it should be "Automatically use/create" checkbox.

    If it says stdafx.[red]pch[/red], that [italic]is[/italic] a bug. It should say stdafx.[red]h[/red].

    "Project->Settings->Precompiled Headers" should look like this:
    [code]
    stdafx.h - [X] [b]Create[/b] precompiled header file.
    Through Header: [b]stdafx.h[/b]

    *.cpp - [X] [b]Use[/b] precompiled header file.
    Through Header: [b]stdafx.h[/b][/code]

    The only really important thing is that the file specified under "Through Header" matches for both the file generating the precompiled header, and the files using the precompiled header.

    Obviously, stdafx.h is just a convention, you could name the precompiled header MonkeyAss.h if you wanted to. The advantage of using the name stdafx is that (for Visual C++ generated projects) Visual C++ will automatically set the precompiled header directive for newly added files to stdafx.h.





  • DrakeDrake Posts: 5Member
    AY,

    i see it is the newest thing in C++. Now i know it. But it is only used with the win32...

    can i use this extension on win16? thats the question...

    greetings

  • Eric TetzEric Tetz Posts: 2,141Member
    : AY,
    :
    : i see it is the newest thing in C++. Now i know it. But it is only used with the win32...

    It's not part of C++, or Windows. It's a compiler thing. Microsoft's compiler happens to support them, but so do many others.

    : can i use this extension on win16? thats the question...

    Find a win16 compiler that supports them.

    Cheers,
    Eric


  • DrakeDrake Posts: 5Member
    Greetings,

    thanks a Lot, now i know most everything about :)))

  • pingpongpingpong Posts: 937Member
    : Obviously, stdafx.h is just a convention, you could name the precompiled header MonkeyAss.h if you wanted to. The advantage of using the name stdafx is that (for Visual C++ generated projects) Visual C++ will automatically set the precompiled header directive for newly added files to stdafx.h.

    Erik,

    not true. MonkeyAss.h would work just as great. theres no advantage i can think of by using StdAfx.h instead. i know cause i use them always and the name of all my precompiled header files (non MFC projects) is PreCompiled.h.


  • engnieerengnieer Posts: 2Member

    I have problem in my project in the socket programming can anybody help me this is my project Network taffic generator

    This project will build a network traffic generator. The project will initially build an off-line generator before working on an on-line generator. The project aims to generate traffic according to particular applications and as such will involve much research into particular network traffic types and how they can be represented. The project will require a good knowledge of C and a good programming ability.



    must be i doing program in c++ to server and client for TCP and UDP
    if any one any idea related with my project can tell me please



Sign In or Register to comment.