I am trying to create a simple 2D library, consisting entirely of class templates. I created an empty project, changed configuration type to static library, and then added my header files. It currently looks like this:
When I try to build this project, the build succeeds but no .lib
file is actually created.
When googling for a way to fix this, I found this question and this answer, which refers to the same problem of not being able to generate a .lib
file because the project contains no .cpp
file.
The answer says that they solved it by adding a .cpp
file that just includes all the header files:
And this does indeed solve the issue:
But surely there's a more elegant way of solving this? Why doesn't VS want to generate a .lib
file if you don't do this?