(last question below)
I recently asked a question about how I would fix linker errors (about duplicate characters regarding multiple void template definitions.
Since I used functions in several source files, I was offered to use the inline to allow ads in the header or to place ads in a compiled source file.
After I realized that inline had some bad consequences, I put my ads in the source file.
Now it was good, with the exception of variation patterns:
template<typename T, typename... Args> void cleanup(T *t, Args&&... args);
I found some obvious solutions, but not variation patterns - use a .tpp file (but it started declaring duplicate characters again) or save the original file and add explicit instances.
But void cleanup has the potential to use hundreds of combinations of parameters, so I donโt want to explicitly create all instances.
Question: So, how would I go or
- Saving variational template definitions in the source file, OR
- Including definitions in a .tpp file without getting duplicate characters and ultimately avoiding using
inline ?
Examples of duplicate / undefined character errors for declaring .tpp and placing the above template definition in the source file, respectively.
duplicate symbol __Z7cleanupI10SDL_WindowJEEvPT_DpOT0_ in: CMakeFiles/Game.dir/Game/main.cc.o CMakeFiles/Game.dir/Game/RichTools/rtexture.cc.o
_
Undefined symbols for architecture x86_64: "void cleanup<SDL_Renderer, SDL_Window*&>(SDL_Renderer*, SDL_Window*&&&)", referenced from: cleanQuit() in main.cpp.o ld: symbol(s) not found for architecture x86_64