Thread: I have a compile error that i do not know how to fix

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    6

    I have a compile error that i do not know how to fix (Updated).

    Deleting intermediate files and output files for project 'cs131assign3 - Win32 Debug'.
    --------------------Configuration: cs131assign3 - Win32 Debug--------------------
    Compiling...
    driver program.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    itemtype.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    sortedtype.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 363 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    Error executing cl.exe.

    cs131assign3.exe - 3 error(s), 3 warning(s)



    My include statements are as follows:
    sortedtype.h ------- #include "itemtype.h"
    sortedtype.cpp-------#include "sortedtype.h"


    itemtype.h -----------#include "sortedtype.h"
    itemtype.cpp ---------#include "itemtype.h"

    driver program.cpp ----#include "sortedtype.h"
    #include <iostream>
    #include <fstream>
    Last edited by cgmacewindu; 09-29-2002 at 04:36 PM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: I have a compile error that i do not know how to fix

    Originally posted by cgmacewindu
    Deleting intermediate files and output files for project 'cs131assign3 - Win32 Debug'.
    --------------------Configuration: cs131assign3 - Win32 Debug--------------------
    Compiling...
    driver program.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    itemtype.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    sortedtype.cpp
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : warning C4182: #include nesting level is 363 deep; possible infinite recursion
    c:\program files\microsoft visual studio\myprojects\cs131assign3\sortedtype.h(3) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
    Error executing cl.exe.

    cs131assign3.exe - 3 error(s), 3 warning(s)
    Post the code.

  3. #3
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    you have recursive includes, meaning:

    ====foo1.h====
    #include "foo2.h"

    ====foo2.h====
    #include "foo1.h"

    ====foobar.c====
    #include "foo2.h"

    once foobar.c includes foo2.h, the preprocessor will jump back and forth between foo1.h and foo2.h until your mom comes home.
    hello, internet!

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    If this is truely the case you should put inclusion guards on your headers.
    Code:
    #ifndef __MYHEADER_H__
    #define __MYHEADER_H__
    
    // FOO!!!!!
    
    #endif /* __MYHEADER_H__ */
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. acerhk wont compile
    By cretard in forum Linux Programming
    Replies: 8
    Last Post: 03-16-2009, 03:35 AM
  2. help newbie compile program!
    By candysandra88 in forum C Programming
    Replies: 7
    Last Post: 12-13-2008, 11:27 PM
  3. Can't compile anything
    By beanroaster in forum C++ Programming
    Replies: 8
    Last Post: 07-15-2008, 06:17 PM
  4. Compile question?
    By tomy in forum C++ Programming
    Replies: 6
    Last Post: 04-11-2008, 05:33 AM
  5. compile prob: sched.h (win32 POSIX threads) - pid_t
    By BrianK in forum Windows Programming
    Replies: 6
    Last Post: 04-11-2003, 05:52 PM