Thread: Weird fatal error, header file related

  1. #1

    Weird fatal error, header file related

    I am using VC++6 and I ran into a weird problem, I got a fatal error and a warning that are related to header files:

    c:\rt3d\rengine\rcore\rtimer\rtimer.cpp(12) : warning C4182: #include nesting level is 363 deep; possible infinite recursion
    c:\rt3d\rengine\rcore\rtimer\rtimer.cpp(12) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    The thing is that I have a header file needed to be included always, from every other header file. Yes, I use header guards and do not use code into headers.

    Any ideas?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Looks like you are including a header which refers then includes itself......with headers that I will use in multiple modules, I sometimes put the headers in one "globals.h" and include it as the first line in my .cpp files............usually this recursion is easilly avoidable if you are careful what you do with your headers

    You should look to add preprocessor directives to stop multilpe includes

    #ifndef __MY__HEADER__
    #define __MY__HEADER__
    // your normal header stuff here
    This should stop the contents of the header being used more than once......also as you are on VC++, you can include the line

    #pragma once
    in a header and it should do the same thing

  3. #3
    Cool thanks. Yes, I said I know about header guards, I use them widely.

    I found the problem, I was including the header file in the header file or something like that. Wicked.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM