Jump to content
  • Advertisement
Sign in to follow this  
jason1

Way to include all preprocessors

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
No, not really. You'll just have to learn which headers go with which classes and functions you want to use.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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++?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!