Thread: stdafx.h

  1. #1
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    stdafx.h

    hi all
    i'm using the tutorials on windows programming, and when i compile the code i seem to get an error that reads:

    Code:
     stdafx.h: No such file or directory.
    do i have to create this header file or something, because it's really getting on my nerves!

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Just delete the line that includes stdafx.h.
    Those tutorials are crap (and made with VC++), but if you can't find any better ones, then...
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    stdafx is a header that is created when you start a new Windows application (atleast in MSVC). It depends on which compiler you are using. You don't really need this header, so just take the line off that says
    Code:
    #include "stdafx.h"
    This is my stdafx.h that is created in MSVC 2005:
    Code:
    // stdafx.h : include file for standard system include files,
    // or project specific include files that are used frequently, but
    // are changed infrequently
    //
    
    #pragma once
    
    // Modify the following defines if you have to target a platform prior to the ones specified below.
    // Refer to MSDN for the latest info on corresponding values for different platforms.
    #ifndef WINVER				// Allow use of features specific to Windows XP or later.
    #define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
    #endif
    
    #ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
    #define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
    #endif						
    
    #ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
    #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
    #endif
    
    #ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
    #define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.
    #endif
    
    #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
    // Windows Header Files:
    #include <windows.h>
    
    // C RunTime Header Files
    #include <stdlib.h>
    #include <malloc.h>
    #include <memory.h>
    #include <tchar.h>
    
    
    // TODO: reference additional headers your program requires here
    Also, make a .cpp that includes this header.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  4. #4
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    ok... cheers

  5. #5
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I already said that
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  6. #6
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Sometimes your compiler will be set so that it's necessary to have a 'precompiled header directive' included (stdafx), and if you don't #include it, you'll get an error like this

    > fatal error C1010: unexpected end of file while looking for precompiled header directive

    At least with MSVC 03, anyways. I'm not familiar with other compilers. In your project options you can take off the need for this header, if you want.

  7. #7
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    can anyone direct me to any other, better tutorials than the ones on this site about windows programming?

  8. #8
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Moved to windows.

    ***

    Have you checked out any of those mentioned in the windows programming links sticky thread?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. doesn't recognize stdafx.h
    By GiantFurby in forum C++ Programming
    Replies: 4
    Last Post: 03-24-2009, 10:42 AM
  2. stdafx.h and the FreeType library
    By Mastadex in forum Windows Programming
    Replies: 1
    Last Post: 11-23-2007, 01:36 PM
  3. stdafx.h question
    By ssjnamek in forum C++ Programming
    Replies: 5
    Last Post: 08-12-2005, 11:31 PM
  4. stdafx.h
    By HQSneaker in forum Windows Programming
    Replies: 10
    Last Post: 08-13-2004, 12:19 PM
  5. stdafx.h?
    By Ranedhel in forum C++ Programming
    Replies: 1
    Last Post: 01-07-2004, 03:28 PM