locked
Cannot open include file: 'StdAfx.h': No such file or directory RRS feed

  • Question

  • Hello,

    I am a newbie, please tell me what do I need to do to compile this in visual 2005?

    I am trying to compile some code from a friend for a poker game and i get this error:

    "c:\documents and settings\manlee wan\desktop\source\card.cpp(41) : fatal error C1083: Cannot open include file: 'StdAfx.h': No such file or directory

    Chair.cpp"

    For this code:

    "

    #include "StdAfx.h"

    #include ".\chair.h"

    CChair::CChair(void)

    {

    flagDealer = 0;

    }

    CChair::~CChair(void)

    {

    }

    #ifndef MARS

    void CChair::Draw(CPaintDC & dc, int xor, int yor )

    {

    if( myPlayerName.empty() )

    dc.TextOut( xor, yor, "Empty",5);

    else {

    if( ! flagDealer ) {

    dc.TextOut( xor, yor, myPlayerName.c_str() );

    } else {

    string w = "*" + myPlayerName + "*" ;

    dc.TextOut( xor, yor, w.c_str() );

    }

    }

    }

    #endif

    With this header file:

    "

    #pragma once

    #ifndef cchair_h

    #define cchair_h

    class CChair

    {

    public:

    string myPlayerName;

    int flagDealer;

    int flagStillInGame;

    int myChips;

    CChair(void);

    ~CChair(void);

    #ifndef MARS

    void Draw(CPaintDC & dc, int xor, int yor );

    #endif

    };

    #endif

    Tuesday, February 6, 2007 3:13 AM

Answers

  • See Tips on Posting Good Questions, especially the first item about searching. One of the results obtained by searching for stdafx is Precompiled Header Files. which should help you to get a better idea of where to look and what questions to ask if that does not answer the question.

    The contenst of the stdafx.h file depends on the project. Each instance is generated or created for the project. You must obtain it from the project that you got the other project file(s) from.

    Explore other projects that you have generated and that have been generated by ohters. Explore the samples provided with VC. You can learn very well what those silly stdafx files are. The name stdafx results from MFC but the name seems to now be an essential standard that VC uses for most all projects.

    Tuesday, February 6, 2007 9:13 AM

All replies

  • Where do I get this "StdAfx.h" file?

    What site has this file?

    Tuesday, February 6, 2007 3:41 AM
  • See Tips on Posting Good Questions, especially the first item about searching. One of the results obtained by searching for stdafx is Precompiled Header Files. which should help you to get a better idea of where to look and what questions to ask if that does not answer the question.

    The contenst of the stdafx.h file depends on the project. Each instance is generated or created for the project. You must obtain it from the project that you got the other project file(s) from.

    Explore other projects that you have generated and that have been generated by ohters. Explore the samples provided with VC. You can learn very well what those silly stdafx files are. The name stdafx results from MFC but the name seems to now be an essential standard that VC uses for most all projects.

    Tuesday, February 6, 2007 9:13 AM