5
  • Can I make header only libraries such as boost to dll and lib file?

    • looks like yes, right??
  • Environment : Window 10, Visual studio 2015, Cmake

    • How can I build my project files to dll and lib

  • Sorry for very vague questions, but I'm new to c++. So any reference and documentation will be helpful to me.
alexeykuzmin0
  • 6,344
  • 2
  • 28
  • 51
Sangwon Choi
  • 218
  • 2
  • 11
  • 3
    A header only library is just included by the client; it cannot be built to a dll/lib. Some components of Boost are not just headers - these require linking with the Boost lib(s). – Richard Critten Dec 15 '16 at 08:57
  • 1
    If you still want your library to be built to a dll/lib (for example, if you plan to make it non-header-only in future), you can just add a `.cpp` including some of your headers – alexeykuzmin0 Dec 15 '16 at 08:58
  • If your library contains only templates the answer is yes. – drescherjm Dec 15 '16 at 08:59
  • With CMake you'd just end up installing the headers like this `install (FILES header1.hpp header2.hpp ... DESTINATION include)` – Jonas Greitemann Dec 15 '16 at 09:03
  • 1
    ***How can I build my project files to dll and lib*** Search for duplicates for that one. I expect there is a duplicate for how to build a dll using CMake. If you don't find one this should be a separate question from the first. – drescherjm Dec 15 '16 at 09:04
  • 1
    Related to the first question: http://stackoverflow.com/questions/2225435/how-do-i-create-a-header-only-library – drescherjm Dec 15 '16 at 09:16
  • Also: http://stackoverflow.com/questions/12671383/benefits-of-header-only-libraries – drescherjm Dec 15 '16 at 09:18

0 Answers0