TheDoctor
TheDoctor

Reputation: 1530

C++ - Include all sys headers?

I know you can include a specific header file from sys, like #include <sys/stat.h>, but can I include all of the headers from sys?

If this is not possible, could someone point me to where this folder is located?

Upvotes: 1

Views: 3739

Answers (1)

AlexT
AlexT

Reputation: 1451

You have to include all required headers individually. As workaround you can create header file (e.g. all_sys.h) and put all necessary headers from sys into it.

Header files location depends on system/compiler. On my system it's located in /usr/include/sys If you are not sure about location you can look at output of macro-processor. To get it you should use -E option (linux/gcc), for instance:

$ g++ main.cpp -E | less

Notice that if you include redundant headers "just in case" it will increase compilation time unnecessarily

Upvotes: 1

Related Questions