Way to include all preprocessors

Started by
12 comments, last by jason1 18 years, 7 months ago
You've got #include <iostream, <string>, <vector> and all that preprocessor stuff that most programs u need to use. Is there a command that lets you include all of them or a few in just 1 or 2 lines because i have trouble remebering wat all of them mean?
Advertisement
No, not really. You'll just have to learn which headers go with which classes and functions you want to use.
I guess you could create a header of your own and add any new ones to it as needed. It won't be good for you compilation times though (unless you precompile it)..

Still, it's probably a good idea to learn roughly where everything belongs. It's generally quite easy to look it up if you're unsure.
could you explain how to make a header.
Quote:Original post by jason1
could you explain how to make a header.


All you would need to do is this:

1. Create a new file, you can call it "Everything.h" or what ever you want ".h"
2. Now for the source of it:
#include <string>#include <vector>#include <map>#include <iostream>#include <fstream>// Add more header files as needed


There's your header file for all of the includes. All you need to do is add a #include "Everything.h" to all your source files where you need it and you're set.

Traditional header files will have include guards, to prevent redeclaration of variables, but since you are not using this header file, you should not have them in this.

But by no means are you restricted to using a .H file, it's just by convention. If you made your file "Everything.inc", and had a #include "Everything.inc" line, it would work the same. That's about it if you wanted to do this.
ok thnx. also how do u put the code like that on the screen where it came from c++ instead of copy and pasting it and it looking like the rest?
Quote:Original post by jason1
ok thnx. also how do u put the code like that on the screen where it came from c++ instead of copy and pasting it and it looking like the rest?


You can use the [source] [/source] tags to make it have the white box, or you can use the [code] [/code] tags to make it preserve formatted, but not colors or white box.
do u make a header in the same white box/place that u usually see in c++ or do u open up a different file creater on c++?
Same place. Headers are the .cpp files with .h after them..sorta.
gib.son
wat do u mean by sorta?

This topic is closed to new replies.

Advertisement