Thursday, 15 August 2013

c++ - Compiler flag to include some_file_name.h into all files? -


I am working on my esteemed thesis and boost my threading method by std :: threads to boost: : I want to include Threadpool. I am able to easily complete it within each of my files

  #include "../include/threadpool.hpp"  

but It changes a lot with a change in many files / thread systems, is there any way to give a compiler flag (or something) so that all the files basically include the file #?

My inexperienced idea will be something like this

  // dependency # Include "../include/threadpool.hpp" # I need some other dependencies involved.  

One more pass - I "path_to_dependencies.h"
Flag for the compiler Is there anything like this work or am I away from the base?

Thank you!

The latter is the preferred way of doing this. In fact you can go a step further and make it a precomplete header, which will reduce the compilation time by lot , especially if your project gets bigger.

Using GCC, you can read about precompiled headers here:

For Microsoft's compiler, you have a stdafx.h file Everyone knows because it enables precompiled headers by default.


No comments:

Post a Comment