CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Precompiled header include order

    I've just started properly using precompiled headers in my game engine:
    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
    
    
    #define WIN32_LEAN_AND_MEAN    // Exclude rarely-used stuff from Windows headers
    
    
    
    // TODO: reference additional headers your program requires here
    #include <iostream>
    #include <algorithm>
    #include <map>
    #include <string>
    #include <vector>
    I'm getting a lot of errors similar to:
    Code:
    cannot convert parameter 1 from 'const time_t *' to 'const __time32_t *'
    from time.inl.

    From reading around, this seems to be because another file is defining some time-related thing, and that to solve it I should rearrange my include order. However, I've tried switching the order of includes around but the error remains.

    Anyone know how to fix this?

    Cheers.
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  2. #2
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: Precompiled header include order

    Just bumping this up to the top.
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Precompiled header include order

    Which header is time_t defined? Also, do you still have some header include definitions in your cpp files are have these all been moved into stdafx.h?

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Precompiled header include order

    You shown a bunch of directives for including STL headers. The order of STL header inclusion is not important. But you probably have to include time.h if you want to use time_t.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

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

Featured