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


i working on honors thesis , want change threading method std::threads include boost::threadpool. able accomplish doing

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

within each of files, becomes repetitive many files / changes thread systems. there way give compiler flag (or else) files natively #include file?

my naive thought like

//dependencies.h #include "../include/threadpool.hpp" #include //some other dependency need.h 

and pass a
-i "path_to_dependencies.h"
flag compiler. work or off base?

thanks!

the latter preferred way it. in fact can go 1 step farther , make precompiled header, cut down compilation time lot, if project gets large.

i assume you're using gcc, can read precompiled headers here: https://gcc.gnu.org/onlinedocs/gcc/precompiled-headers.html

for microsoft's compiler have stdafx.h file knows since enables precompiled headers default.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -