Too many include files error

Started by
1 comment, last by CJM 18 years, 8 months ago
im getting this error that says: fatal error C1014: too many include files : depth = 1024 i don't really know what it means, so if anybody could help me then it would be really good thanks in advance
Advertisement
Is it possible some header files have recursive inclusion?

For example

in OMG1.h:
#include <OMG2.h>

in OMG2.h:
#include <OMG1.h>
Hey,

You probably have something like the following:

File1.h:
#include "file2.h"

File2.h:
#include "file1.h"

Something.cpp
#include "file1.h"

Basically, an include is a complete paste of the source of the file in at that point. If you have circular references then you'll keep pasting until you get that error.

You can fix it by using inclusion guards to ensure that you haven't included the same file many times.

At the top of your .h files try:
#pragma once

if you're using VC++, or otherwise:
#ifdef __FILE1_INCLUSION
#define __FILE1_INCLUSION
.. <- file content goes here
#endif

but make sure that each of the files use different names for the inclusion.

Hope this helps,

CJM

[edit: beaten!]

This topic is closed to new replies.

Advertisement