Search code examples
c++visual-studioheader-only

What's the proper way of using header-only library?


I've ran into a confusion about how to properly use header-only library. Googling didn't help as I didn't find anything about using header-only libraries.

So my question is: Should I just copy the header files and paste them into my project folder and use them that way or should I link them to the project using C\C++ >> General >> Additional Include Directories?


Solution

  • I'd say copying the file to your project folder is preferable. That way your project is self contained. You could then give it to someone else and he would be able to build it without having to change any configuration.

    Now, if you use boost which also has header-only libraries it is another story. Boost is easily obtainable and having your project depend on boost is less problematic. In that case I would add it in the Additional Includes.