How to auto-include all headers in directory

Posted by JRL on Stack Overflow See other posts from Stack Overflow or by JRL
Published on 2010-03-12T18:21:54Z Indexed on 2010/03/12 18:37 UTC
Read the original article Hit count: 256

Filed under:
|
|

I'm going through exercises of a C++ book. For each exercise I want to minimize the boilerplate code I have to write. I've set up my project a certain way but it doesn't seem right, and requires too many changes.

Right now I have a single main.cpp file with the following:

#include "e0614.h"
int main()
{
    E0614 ex;
    ex.solve();
}

Each time I create a new class from an exercise, I have to come and modify this file to change the name of the included header as well as the class i'm instantiating.

So my questions are:

  1. Can I include all headers in the directory so at least I don't have to change the #include line?
  2. Better yet, can I rewrite my solution so that I don't even have to touch main.cpp, without having one file with all the code for every exercise in it?

© Stack Overflow or respective owner

Related posts about c++

Related posts about include