I have three c++ files, sort.cpp defines a bubble sort function that takes an array, the length of the array and a function that is used to do the comparison. sort.h contains the function prototype inside a namespace. main.cpp is used to test the implementation.  sort.h:  #ifndef SORT_H #define SORT_H  namespace sort {     template &lt;typename T&gt;     void bubble(T*, int, bool (*)(T, T)); }  #endif   sort.cpp:  #include "sort.h"  template &lt;typename T&gt; void sort::bubble(T *array, int length, bool (*compare)(T, T)) {     while (length != 0) {         int newLength {0};         for (int i {0}; i &lt; length - 1; ++i) {             if (compare(array[i], array[i+1])) {                 T temp {array[i]};                 array[i] = array[i+1];                 array[i+1] = temp;                 newLength = i + 1;             }         }         length = newLength;     } }   main.cpp:  #include &lt;iostream&gt; #include "sort.h"  bool larger(int x, int y) {     return x &gt; y; }  int main() {     int arr[] {3, 5, 1, 3, 7, 2};     sort::bubble(arr, 6, larger);     for(const auto e: arr)         std::cout &lt;&lt; e &lt;&lt; ' ';     std::cout &lt;&lt; '\n';     return 0; }   When I compile with g++ main.cpp sort.cpp -std=c++11 I get the error  Undefined symbols for architecture x86_64:   "void sort::bubble&lt;int&gt;(int*, int, bool (*)(int, int))", referenced from:       _main in main-767bbd.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)   Do I get the error because the compiler doesn't know which types I'm going to use when compiling sort.cpp? So the compiler doesn't generate any function off of the template and then the linker can't find it when I use it in main.cpp?  How can I solve this issue?
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.)
Need advice on flavoring/sweetening my homebrew cider I've just finished my primary fermentation and have produced a cider that is coming in at 5.2%. I am about to bottle my cider and add some priming sugar to give it a bit of a fizz. I would like to try and flavor some of the ciders with a fruit coulis. am I correct in thinking that the natural sugar in the fruit should give the cider a natural fizz and I don't need to add any sugar? Also, I am a fan of a sweeter cider, I have been advise not to add more than a teaspoon of priming sugar, and to use a sugar substitute at the same stage if i wish to sweeten it. I have purchased Xylitol, I plan on trying a few combinations with the priming sugar/Xylitol &amp; no additive fruit coulis. Does this all sound like it makes sense or am I just going to ruin my cider. Find the minimum of $\sqrt{(x+1)^2+(y-1)^2}+\sqrt{(x+2)^2+(y+2)^2}+\sqrt{(x-1)^2+(y+1)^2}$ For real $x,y$ Find the minimum of $\sqrt{(x+1)^2+(y-1)^2}+\sqrt{(x+2)^2+(y+2)^2}+\sqrt{(x-1)^2+(y+1)^2}$ For real $x,y$. It is the distance of a point in a triangle from its vertexes which gives the minimum when $(x,y)$ is on the Fermat's point.  But now I am stuck in finding the location of Fermat's point.  $(1) \quad 4$ $(2) \quad 5$ $(3) \quad \sqrt{3}+2\sqrt{5}$ $(4) \quad 4\sqrt{2}$ Can a wizard choose where to place their soul piece when creating a horcrux? Multiple authors in one row with refmark, multiple affiliations in separated columns in another row I wonder how we can list author names in the following format in LaTeX.   I have 5 authors with 3 different affiliations. I am trying to list all author names with refmark in one row, and 3 affiliations with refmark in another row, but each in one separated column. It should look like this:          author1{1} author2{2} author3{1} author4{2} author5{3}            {1}department      {2}department        {3}department               school              school              school               email                email              email   I did saw some papers that have the above format, but cannot search for any guideline. IEEE guideline suggests another way to list authors, but sadly it does not look that neat          author1{1} author2{2} author3{1} author4{2} author5{3}                         {1} department, school                               email                         {2} department, school                               email                         {3} department, school                               email How to show that $|D_{2n}| = 2n$ via the presentation? Consider the dihedral group  $$D_{2n}= \langle a,b \mid a^n = 1 = b^2, b^{-1}ab = a^{-1}\rangle$$  How can I show that $|D_{2n}| = 2n$?   I'm trying to show that we can write every element in the form  $$x = a^i b^j$$ where $i= 0, 1, \dots, n-1$; $b = 0,1$.   I managed to show existence, and it is clear that there are $2n$ such elements, so if I can show that every choice of $i,j$ gives a distinct element, I'll be done.  Any ideas? Showing $\frac{x}{1+x}0$ using the mean value theorem White stains and stainless steel cookware I know this question has been asked before in some form or another, but I can't seem to find a definitive answer. I've looked on SA, chowhound, martha stewart, about.com, etc., and answers seem to vary. Answers that I've seen vary from using vinegar to washing using special stainless steel soaps (which I'm not very keen on using) to only using soft sponges and hot water.   The one thing I always do is wash my stainless steel with warm soapy water and a soft sponge. If there's burned food stuck on the cookware, I scrape it off with a wood pot scraper (lightly, of course). And I always dry with a soft cloth immediately after washing. Yet I still get stains!  I'd like to get a general consensus on how to prevent those white and rainbow colored stains as well as minimizing corrosion. Let $A$ be a square matrix of order $n$ such that $A^2 = I$.  Prove that if $1$ is the only eigenvalue of $A$, then $A = I$. Prove that $A$ is diagonalizable.   For  (1), I know that there are two eigenvalues which are $1$ and $-1$, how do I go about proving what the question asks me? Reference template variable within Jinja expression Resetting theorem counters: \section and (missing) \subsection $a+1,a-1$ invertible for nilpotent element Given a ring $R$ (with unity), prove that if $a \in R$ is nilpotent, then $a+1,a-1$ are both invertible.   Suppose $a^n=0$. Then $1=1-a^n=(1-a)(1+a+\ldots+a^{n-1})$, so $1-a$ is invertible.  If $n$ is odd we can use $1+a^n=(1+a)(1-a+\ldots+a^{n-1})$.  But what if $n$ is even? How do I get an XBOX 360 controller working? I have a Microsoft XBOX 360 gamepad with the wireless adapter and I was wondering what I would have to install to use them with Ubuntu I do know that when using this on Windows I have to manually install the drivers for the wireless receiver (if that is relevant.) Primary key or Unique index? At work we have a big database with unique indexes instead of primary keys and all works fine.  I'm designing new database for a new project and I have a dilemma:  In DB theory, primary key is fundamental element, that's OK, but in REAL projects what are advantages and disadvantages of both?  What do you use in projects?  EDIT: ...and what about primary keys and replication on MS SQL server? How can I (in order of preference, descending):   Disable file-server access to a specific share for a user or group based on the time of day. Disable file-server access entirely for a user or group based on the time of day Disable file-server access entirely (server-scope) based on the time of day. This is not at all related to Remote Desktop/RDP access.   For example, Bob is in the group WorkHours. The share "Documents" grants access to users in the group WorkHours. How do I deny access to all files in the share "Documents" from 7PM to midnight, every day, automatically? Why must I wait two days before accepting my own answer? I got this message today while trying to accept my answer on my own question.  Why must I wait this time, if I am sure that the answer I answered is the right one, just want to understand the point of view?  I faced that just today on Super user and didn't get this message before. I want to make Morrocan-stye pickled lemons, but I was only able to find , and it says:  In On Food and Cooking, Harold McGee suggests that a solution of five to 10% salt is needed to achieve a good North African-style preserved lemon  I make sauerkraut with 20 grams of salt per kilogram of cabbage, so 2%. So lemons taking much more salt than cabbage is surprising and confusing; since they start out acidic, I would expect them if anything to require less salt. I'm not worried about harmful microbes growing; I'm worried about the fermentation microbes not being able to grow. It's my understanding that higher salt concentrations with cabbage not only slow down fermentation, but actually .  had the same issues:  I've never quite understood the need for such excessive salting when making preserved lemons. They still ferment great at normal levels of salt, and you then need to worry less about them being overly salty to use in future recipes. As far as I can tell it's solely from tradition. Also, from checking out On Food and Cooking, it seems that McGee only points out that originally they are done with 5 to 10% salt content. I'm curious where you read/saw that he recommended such?  Does anyone have any text- and/or experience-based opinion agreeing or disagreeing with the &quot;5 to 10%&quot; figure? Where does matter go after reaching singularity in uncharged black holes? I am a layman in physics and just read about black holes on the internet. I read that matter encounters geodesic incompleteness in the singularity in an uncharged black hole.  I heard an analogy of geodesic incompleteness as a straight line on a paper reach a hole on the paper, so it cannot continue. But in this analogy, isn't the straight line possible to continue into 3D (continue down the paper)? So, if matter reaches the singularity, is it possible too (to reach another dimension)?   I also heard that the matter is annihilated when reaching the singularity, does it mean it disappear from this world, and violates conservation of energy? Show that if $f$ is integrable on $[a, b]$ then $\lvert f \rvert$ is also integrable. Hint: Show that $$U (P , \lvert f \rvert) − L(P , \lvert f \rvert) ≤ U (P , f ) − L(P , f ).$$ I have: $$U (P , \lvert f \rvert) \ge U (P , f )$$ and $$ L(P , \lvert f \rvert) \ge L(P,f)$$ Thus, $$U (P , \lvert f \rvert) − L(P , \lvert f \rvert) ≤ U (P , f ) − L(P , f ).$$ Consider a database table holding names, with three rows:  Peter Paul Mary   Is there an easy way to turn this into a single string of Peter, Paul, Mary? Notification email from stackoverflow contains "<3" after zip code I noticed "&lt;3" appears at the very end of the my stackoverflow notification emails (after the zip code). Is this problem related to gmail?