include differences
Hi, I''ve recently switched from using Borland C++ Builder 4 pro to MS Visual C++ 6 standard. I was moving some source files over in a project and i noticed it didnt like the way i included header file. In BCB i included things like gl.h in the main source file, when i included my own source and header file, they would get instant access to the first included file (ie gl.h) without typing #include <..> again in the file. VC++ doesnt like this so i typed out a new #include <gl\gl.h> in one of the source files. It now comes up with errors in the gl.h file! I take it that it has something todo with multiple includes or some thing. Could some one tell me how to get around this problem in VC++? If your confused of what i said, say and i''ll retype this clearer if i can!
Thanks
-J
It would mainly help if you told us what the errors were(error codes and text) and gave us an example of what you''re trying to do.
____________________________________________________________
Direct3D vs. OpenGL
____________________________________________________________
Direct3D vs. OpenGL
I''ve had to include:
#include <windows.h>
#include <gl\gl.h>
in most of my project files, so that the functions are reconised. Now it comes with these errors:
c:\windows\desktop\c++ stuff\3d snake\vc\scene_control.cpp(2) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
c:\windows\desktop\c++ stuff\3d snake\vc\scene_control.cpp(2) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Error executing cl.exe.
#include <windows.h>
#include <gl\gl.h>
in most of my project files, so that the functions are reconised. Now it comes with these errors:
c:\windows\desktop\c++ stuff\3d snake\vc\scene_control.cpp(2) : warning C4182: #include nesting level is 362 deep; possible infinite recursion
c:\windows\desktop\c++ stuff\3d snake\vc\scene_control.cpp(2) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Error executing cl.exe.
Sounds like you have some headerfile that is including itself.
Wannabe
warning C4786: identifier was truncated to ''255'' characters in the debug information
Test.exe - 0 error(s), 76 warning(s)
Wannabe
warning C4786: identifier was truncated to ''255'' characters in the debug information
Test.exe - 0 error(s), 76 warning(s)
can that be done indirectly?
FILE1**********
#include "file2.cpp"
code here
FILE2*********
#include "file1.cpp"
code here
Is there a way to include a header file once (like gl.h) and its availible for all the files in a project?
-J
FILE1**********
#include "file2.cpp"
code here
FILE2*********
#include "file1.cpp"
code here
Is there a way to include a header file once (like gl.h) and its availible for all the files in a project?
-J
Never #include .CPP files. The example you just posted will give you an infinite loop such as the one your compiler complained of. And no, there''s no automatic way to have a header #included for every file.
Maybe reading this article will help. It explains more about what to #include and what not to.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions ]
Maybe reading this article will help. It explains more about what to #include and what not to.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions ]
So how would u have cpp files include, do u make those cpp file include a .h file, then just include those?
My guess would be to just make the CPP files part of your "project" usually in IDEs there is a button called Add to Project or something like it.
struct Geek {
void e_mail = belgedin@earthlink.net;
void url;
int age = 17;
};
struct Geek {
void e_mail = belgedin@earthlink.net;
void url;
int age = 17;
};
I did but it doesnt matter now, I''ve got half the problem sorted, have a look at my new thred!
http://gamedev.net/community/forums/topic.asp?topic_id=93536
-J
http://gamedev.net/community/forums/topic.asp?topic_id=93536
-J
quote:Original post by Xanth
struct Geek {
void e_mail = belgedin@earthlink.net;
void url;
int age = 17;
};
[offtopic]
Your Geek structure a.) will not compile, and b.) is susceptible to bugs. You can''t declare void variables, and it''s better for you to store age as an unsigned int (so it can never be negative).
[/offtopic]
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement