In general, templates are implemented in the header files (as many answers in Stack Overflow point out) so the code template is available to the compiler when it needs it to create a new instance of the class/function. However, in my case, some of the methods in my template class can be used only for a certain type, so my class looks like:  Class header  #ifndef LEC_H #define LEC_H  #include &lt;iostream&gt;  template &lt;typename T&gt; class LEC { public:   LEC()   {   }    void func() const;    void func2() const   {     std::cout &lt;&lt; "Func 2" &lt;&lt; std::endl;   } };  #endif  // LEC_H   Class cpp  #include "lec.h"  template &lt;typename T&gt; void LEC&lt;T&gt;::func() const {   std::cout &lt;&lt; "Func: " &lt;&lt; typeid(T).name() &lt;&lt; std::endl; }  template class LEC&lt;float&gt;; template class LEC&lt;double&gt;;   The last two lines of the cpp file allow me to use func() because I explicitly instantiate this class template for these two types. When I use this class template in a program I can use any type as long as I do not call func():  #include "lec.h"  int main() {   LEC&lt;float&gt; a;   LEC&lt;double&gt; b;   a.func2();   a.func();   b.func2();   b.func();   LEC&lt;char&gt; c;   c.func2();   return 0; }   But, since the code is not available for the compiler to intsantiate func() for a LEC class with type char, I cannot do c.func() or I will get a compiler error:     undefined reference to `LEC::func() const'   This is a simplification of my real code. However, in my code, when I do LEC&lt;char&gt; c to create an instance of the class I get the error, without calling any methods, only by constructing the class.    Any idea on how to find out why this, apparently not used method, has to be linked anyways?  Is there a way so the compiler (in my case I am using clang++: clang version 6.0.0-1ubuntu2) points out where is this method used within the code?  Otherwise, can somebody explain why this (not having to link to a non-used class method) is working in the provided example and not in my code?   Edit The cmake looks like:  add_library(lec_lib SHARED lec.cpp lec.h) add_executable(lec_main main.cpp) target_link_libraries(lec_main lec_lib)   Hence, the compiled library is linked with the executable.  Edit 2 Please avoid suggesting answers such as  since I already know that the template has to be available to the compiler when the class is instantiated for a new type. My question is different. Why can I instantiate a type for which not all the template implementations are available as long as I do not use the specific class methods for which the template implementation is not provided at instantiation time (in the example case func())  Edit 3 Regarding the suggestion that this is a duplicate of . Again my question is different. I am looking for answers on why in the example I can instantiate LEC&lt;char&gt; when LEC&lt;char&gt;::func() is not visible for the compiler when it compiles the main program. And inthe case that this cannot be done and L3C&lt;char&gt;::func() is required to be linked, how to find why the method linkage is required while it is not being used (which is what happens in my real code).
Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
How to add coloured line before caption? subcaption vs. subfig: Best package for referencing a subfigure I'm stuck underground.   I can't mine any further to reach lava. There is no water nearby, and zombies can't reach me.  I can't see to find any blocks to suffocate my character.  NBTEdit and similar programs don't work on Mac, so I can't edit my save file to escape. I have hardly any blocks so cannot jump and lay my way up. I can't see, and do not have any torches, so can't make a staircase back up. I don't want to make new save as I have an awesome house filled with stuff that took me ages to find.    How can I get back to the surface? Unintentional Lies and Misinformation Why do people have darker skin in sunnier climates? I don't understand why darker skin is advantageous in hotter climates. Wouldn't it absorb more of the heat? I have heard that it reduces the incidence of cancer, but I would think absorbing more radiation would increase the risk? The result of a Google search for &quot;error&quot; and &quot;PREP line&quot; is:  &quot;error&quot; &quot;on line&quot;: 439,000,000 results &quot;error&quot; &quot;in line&quot;: 60.600.000 results &quot;error&quot; &quot;at line&quot;: 35,800,000 results  While on is the indisputable number one, in and at have also very many hits. In the following context, which one should I use.  __ the first line you create an instance of XXX and XXX leads to the runtime error __ the last line.  I think, both prepositions are different. Although the word create refers to the action which is executed while runtime, the former part refers to the actual code that is written. In contrast, the latter part is figurative. I don't refer to the written code. The error does not really occur in the code but the code is the representation of the assembly which fails. Thus, I have two bests guess:  On the first line you create an instance of XXX and XXX leads to the runtime error at the last line. In the first line you create an instance of XXX and XXX leads to the runtime error on the last line. How can i get currency symbols from currency code in iphone? Can there be a notification for those people that participated in the question in the past (either who asked or answered it) once a bounty is started on it? Adobe Illustrator: strange behavior while aligning objects I am creating icons with Adobe Illustrator during which process I use the Align tool quite frequently.  All of a sudden, the align tool started behaving quite strangely.  When I select two objects and specify that I want to align to a key object, when I press align it seems to only align halfway to where it should be.  When I press align again it aligns halfway again - after I press it several more times, it finally gets to where it needs to be.  Also, when I try to align to artboard, it pushes the object out to a seemingly random place.  Here is a video showing exactly what I mean:   What setting did I accidentally set to make align behave like this? I understand why the Empire would want to start using more than one genetic template to create clone troopers, but why did it start using non-clone troopers instead of just continuing the cloning program?  It seems that with cloning they were able to use a training program (and genetic manipulation) that gave them completely loyalty (other than when the Kaminoan rebellion, where the Kaminoans had sabotaged the training programs).  Why stop using such troops and start using people that might question orders or aren't as easily controlled as clones were? Anime about a boy and a girl who ride ostrich-like creatures through a valley What is the simplest and most robust way to get the user's current location on Android? Change bounding box of math glyphs in LuaTeX I'm trying to use the Garamond-Math font in LuaTeX (despite the documentation saying I should use it with XeTeX only :-). It's working more or less OK with LuaTeX, except for some unfortunate glyph combinations, mostly at the end of inline math, such as “where $T$ is the period”.  I used \fbox to draw the bounding box of the glyph and noticed that the bounding boxes are different in LuaTeX:        and in XeTeX:        In XeTeX the glyph fits almost entirely in the bounding box, but in LuaTeX it overshoots far too much.  I'm not a font guy, so I have no idea why this happens. I thought the bounding box was a property of the font, so in my imagination the result should be the same. Thus the first question is: what actually happens that the bounding boxes are different?  The second question, in the title, is: can I change the bounding box of specific glyphs (using LuaTeX) so that the output looks more like XeTeX's?  I tried manually adding some spacing after the glyphs, but this looks hideous and will go down the drain if I happen to change the font or engine, so I'd really like not to do that. I also tried using the italic correction \/ but it seems to have no effect in math.  Here's the code to produce the pictures above:  \documentclass{standalone} \usepackage{unicode-math} \setmathfont{Garamond-Math.otf} \begin{document} \fboxrule=1sp \fboxsep=0pt In Lua\TeX{} this \fbox{$T$} looks horrible, but the \fbox{$X$} looks OK. \Huge\fbox{$T$}\quad. \end{document}   I'm using TL 2018:  This is LuaTeX, Version 1.07.0 (TeX Live 2018)  (format=lualatex 2019.3.29)  13 APR 2019 12:43  restricted system commands enabled. **test.tex (./test.tex LaTeX2e &lt;2018-12-01&gt; Lua module: luaotfload-main 2019-02-14 2.96 luaotfload entry point Title of novel with girl who can read minds by observing body language, later communicates with a hive mind on an alien planet's surface As a kid I was greatly influenced by a book where a girl (I believe her name was Marlena) lived in a ship orbiting an alien planet.  The ship was intended to colonize the planet but the humans had encountered difficulty.  People on the surface early on had gone incurably mad.  The planet was covered with single cell organism, but no other life.  Other than the "bacteria" it was sterile.    The girl, along with most of the colonists, was still living on the orbiting ship for the foreseeable future.  The girl had an uncanny knack of reading people's minds by noting minute changes in behavior and body language, kind of like Sherlock Holmes' famous observations.  Eventually she got a chance to go to the surface, and found the planet trying to communicate with her.  In one memorable scene the swirls in the water of a stream formed a face and started trying to call her name, "Eeeena, Aaleeena, Aarleena, Marlena!"  It turns out that the single celled organisms on the planet comprised a hive mind which had tried to communicate telepathically with previous humans by altering their brains slightly, causing the madness.  The girls's brain was different, however, constantly modifying and changing itself so that it was not damaged by the hive mind's attempts to communicate with it. I have a simple question answer to which would help me more deeply understand the concept of (non)commutative structures. Let's take for example (our teacher's definition of) a ring:  Let $R\neq \emptyset$ be a set, let $\oplus:A\times A \to A$ and $\bullet :A\times A \to A$ be binary operations. Moreover, let $(R, \oplus)$ be a commutative group, $(R, \bullet)$ be a monoid and following property holds for all $a, b, c\in R$: $$a\bullet(b\oplus c) = (a\bullet b)\oplus(a \bullet c)$$ $$(b\oplus c)\bullet a = (b\bullet a)\oplus(c \bullet a)$$ Then ordered triple $\mathbf R = (R, \oplus, \bullet \mathbf)$ is called a (unitary) ring.  Moreover, we call ring $\mathbf R$ commutative iff $(R, \bullet)$ is a commutative monoid. Commutativity of a ring is always a matter of its multiplicative operation because the additive operation is always assumed to be commutative.  Could anyone explain me the bold part? Why do we even in non-commutative rings (and fields etc.) assume the addition to be always commutative? Is there some serious reason? Would it make any trouble? Or studying of structures with non-commutative addition just doesn't give us anything new so we can take addition as commutative simply because of our comfort? Why when importing an obj file nothing appears even when zooming? I have opened a new blender file and deleted the default cube, then imported an obj file . I did not see any thing so i selected it and i zoomed ,nothing appears.In the outliner i saw the object name ,But in the info panel i see that there isn't any verts/faces/edges.  When i opened the obj file in a text editor i found Mesh data in it. I tired this in all blender versions (2.78c/2.78.5/7.9). Can any one help how to view the mesh? Name for a word whose sound is contrary to its meaning Surjectivity of Composition of Surjective Functions Suppose we have two functions, $f:X\rightarrow Y$ and $g:Y\rightarrow Z$. If both of these functions are onto, how can we show that $g\circ f:X\rightarrow Z$ is also onto? The Wikipedia page () proves that $$f(x) = \begin{cases}  \exp(-1/x),  &amp; \mbox{if }x&gt;0 \\ 0, &amp; \mbox{if }x\le0 \end{cases}$$ is a non-analytic smooth function. But I don't understand why the fact that "the Taylor series of $f$ at the origin converges everywhere [where does "everywhere" mean here?] to $0$" implies the Taylor series converges to $0$ when $x&gt;0$? Can someone explain this in greater detail? I guess there should be a gap in my understanding of power series. What’s the rule for adding “-er” vs. “-or” when forming an agent noun from a verb? What’s the rule to decide whether you add -er or whether you add -or when creating an agent noun from a verb?    Sometimes it’s -er:      read > reader hate > hater hit > hitter   But other times it’s -or:    meditate > meditator collect > collector