Weird fatal error, header file related

This is a discussion on Weird fatal error, header file related within the C++ Programming forums, part of the General Programming Boards category; I am using VC++6 and I ran into a weird problem, I got a fatal error and a warning that ...

  1. #1
    alkis_y3k
    Guest

    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:

    Code:
    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
    Posts
    5,789
    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

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

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

  3. #3
    alkis_y3k
    Guest
    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.

    Thanks!

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, 01:44 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 02:04 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05: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, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21