| | |
Too many includes
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 68
Reputation:
Solved Threads: 0
I like really clean code so I want to pull all of the common includes into a separate file and then include that single file in all my other files. Also makes it easier if I start using a new or different library cuz I only have to change it in one place.
here is what i have in my include.h file:
Each file has Simple enough.
VS2008 gives me error C1014: Too many includes. I'm pretty sure from browsing other posts that this means I'm doing recursive including. But if I do it any other way it says it can't find any of the data types that are defined in the includes.
Thanks for any help.
here is what i have in my include.h file:
C++ Syntax (Toggle Plain Text)
#ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> #endif // System Includes // #include <iostream> #include <cstdio> #include <fstream> #include <string> // Imported Libraries // #include "xmlParser.h" // Our Includes // #include "image.h" #include "enum.cpp" // OpenGL Includes // #include <GL/gl.h> #include <GL/glut.h> using namespace std;
Each file has
C++ Syntax (Toggle Plain Text)
#include "include.h"
VS2008 gives me error C1014: Too many includes. I'm pretty sure from browsing other posts that this means I'm doing recursive including. But if I do it any other way it says it can't find any of the data types that are defined in the includes.
Thanks for any help.
•
•
Join Date: Nov 2007
Posts: 1,274
Reputation:
Solved Threads: 264
•
•
•
•
yes. it's just a cpp file (probably could be .h) that holds some enums. no actual code in it or includes
[EDIT]
Assuming "Each file" refers to source files ...
[/EDIT]
Last edited by mitrmkar; Mar 18th, 2009 at 12:47 pm.
You must use include guards. Do this:
C++ Syntax (Toggle Plain Text)
#ifndef FILENAME_H_ #define FILENAME_H_ // header code here #endif
You put the guards in the *.h files that you wrote, not the STL or other system files. If you are getting errors, then you didn't do it correctly, and you should post the header file w/guards so we can see what you did.
C++ Syntax (Toggle Plain Text)
//"xmlParser.h" #ifndef XMLPARSER_H #define XMLPARSER_H // stuff goes here #endif
Last edited by Ancient Dragon; Mar 18th, 2009 at 3:07 pm.
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
![]() |
Similar Threads
- Basic PHP Includes (PHP)
- includes - trying to bring modules into html documents (HTML and CSS)
- HTML and Server Side Includes (HTML and CSS)
- Help! Don't Know How to Edit includes/config.inc file!! (MySQL)
- Dyanamic Drive Now includes AJAX and OPERA (IT Professionals' Lounge)
- *New* Fully Automated Reseller Hosting Plans, includes Billing and Help Desk System!! (Web Hosting Deals)
- PHP Includes??? (PHP)
- Parse error: parse error, unexpected T_STRING in /home/thei2k9/public_html/includes/f (PHP)
- Multiple PHP INCLUDES (PHP)
Other Threads in the C++ Forum
- Previous Thread: Problem with functions
- Next Thread: static_cast vs (type)
Views: 702 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for C++
6 algorithm array arrays assignment beginner binary c++ c/c++ calculator char class classes client code command compile compiler constructor conversion convert count data delete dll dynamic encryption error file files fstream function functions game givemetehcodez graph gui helpwithhomework homework iamthwee input int lazy lib link linker list loop loops math matrix memory newbie number numbers object objects opengl operator output parameter pointer pointers problem program programming project python random read recursion recursive reference server simple sockets sort spoonfeeding string strings struct student studio template templates text time tree url variable vc++ vector video visual void win32 window windows winsock wordfrequency






