when to use #include?

I'm currently writing a pretty big program separated into .cpp and .h file and i have a question about #include's:
-I know that if i include an existing c++ library (that is not external) twice the second one will be ignored due to the #ifndef #define and #endif preprocessor directives.
-what confuses me is should i for example include the same libraries inside the .cpp and .h files the are having a "has-a" relationship ?
example:

File_scanner.h
1
2
3
4
5
6
7
#ifndef File_scanner
#define File_scanner
#include<iostream>
#include<fstream>
#include<sstream>
//i spare the code or the post will be too long
#endif 


File_scanner.cpp
1
2
3
#include "File_scanner.h"
//should i define the same libraries as in File_scanner.h?
//i spare the code or the post will be too long 


File_compressor.h
1
2
3
4
5
6
7
8
9
#ifndef File_compressor
#define File_compressor
#include "File_scanner.h"
//this class has a "has a" relationship with File_scanner and use the same
//libraries.
//should i include the File_scanner.h or use the libraries in it instead/in addition to the
//#include "File_scanner.h"?  
//i spare the code or the post will be too long
#endif 


File_compressor.cpp
1
2
3
4
#include "File_compressor.h"
//should i use the libraries in addition to the File_compressor.h ?
//(same libraries as in its .h includes)
//i spare the code or the post will be too long 

Last edited on
yes but the question is about coding style it just doesn't seem right the way i use it although it does obviously work.
Last edited on
Topic archived. No new replies allowed.