C ++ linking header and third party source
I'm trying to integrate TinyXML version 2 into a project, but since TinyXML is so tiny (ha!), It hasn't been packaged into a static or dynamic library. Only title and source are provided. I am getting linker errors because the compiler cannot find the source file to link to the header (they are in the same place).
Is there a way to link a third party source to a project without having to copy it to the local project space?
OR
Do I have to manually create a library file (containing one source file) and just use that to solve the problem (although a non-modifying source is a good reason to package it, it seems too complicated for a single file)?
[Cm. tags]
Since you don't want this in your local project space, you seem to be considering it as a library, at least conceptually.
Create the library file once and don't worry about it anymore.
The number of source files in the library shouldn't concern you.
Include tinyxml2.cpp
instead tinyxml2.h
. Or you can create a file .lib
, include the .h
file and tell the linker to use.lib
Alternatively, create a custom static library, just # including.cpp files in a single translation unit. This may be annoying to some, but it is a simple solution that also has its benefits.