I am trying to make static library for solving probability and stats.  I am getting LNK2019 unresolved external symbol error when running my code. I think the program isnt detecting the definitions of function from the .cpp file and i dont get the issue here. Also i have given the main file directions for the library so no issue there. I am new in using headers and templates so kindly help. The error occurs when the program calls the constructor for the object:  &gt; LNK2019   unresolved external symbol "public: __thiscall ProbnStatslib::means&lt;float&gt;::means&lt;float&gt;(void)"(??0?$means@M@ProbnStatslib@@QAE@XZ) referenced in function_main   Header file:  // .h file #ifndef PROBNSTATSLIB_H #define PROBNSTATSLIB_H #include&lt;iostream&gt; #include&lt;vector&gt;  namespace ProbnStatslib {     template&lt;typename any&gt;     class means      {     private:         std::vector&lt;any&gt; xi_mean;         int N;     public:         means();         void initializer(int size);         void CalcMean();      };  } #endif   The .cpp   // .cpp #include&lt;iostream&gt; #include"ProbnStatslib.h" #include&lt;vector&gt; using namespace std; namespace ProbnStatslib {     template&lt;typename any&gt;     means&lt;any&gt;::means()     {         cout &lt;&lt; "object constructed" &lt;&lt; endl;         cout &lt;&lt; "Enter number of ouccrances:" &lt;&lt; endl;         cin &gt;&gt; this-&gt;N;         initializer(this-&gt;N);     }     template&lt;typename any&gt;     void means&lt;any&gt;::initializer(int size)     {         cout &lt;&lt; "Enter event values or Xi of size:"&lt;&lt; size &lt;&lt; endl;          /*for (any value : xi_mean)         {             cin &gt;&gt; this-&gt;xi_mean;         }*/     }     template&lt;typename any&gt;     void means&lt;any&gt;::CalcMean() {         cout &lt;&lt; "Calculating" &lt;&lt; endl;     }  }   The main file:  #include &lt;iostream&gt; #include &lt;vector&gt; #include "ProbnStatslib.h" using namespace std; using namespace ProbnStatslib; int main() {     means&lt;float&gt; myobj;     return 0; }
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.)
I don't really know much about entropy but I learned recently that the entropy in the universe is constantly increasing and that perhaps someday we will reach maximum entropy and the universe will end in heat death. In order for this to be true there are two prerequisites:   Heat must constantly be created. There must be no way to destroy heat (at least no way that turns it into a more useful form of energy).   1 is certainly true. Every process creates some heat. When a person walks his/her feet hit the ground with kinetic energy and the friction creates heat.   But I don't see how 2 can be true. For one thing, heat never even leaves its place of origin (earth, another planet or a star). In order for heat to travel in requires air (or some other conductor/convector). Since there is no air in space there is also no heat. Heat leaves things only in the form of electromagnetic radiation (light) (in the case of earth, infrared).   So conversion from heat to light is certainly possible and is even found in nature. Now how do we get from light to other forms of energy? Well, photosynthesis. Solar panels. So this is possible too. If so, why will we ever run out of useful energy? Even if the rest of the universe does, can't we still reharness our own energy by converting the heat to light and light to other forms of energy?  Suppose the sun died (and leave aside the fact that it would first destroy earth with a supernova), can't we just put up a huge solar panel around earth to pick up all the infrared and convert it back to useful energy? Is it possible to identify this chrysalis? Is there any hint of of the first Wizarding War being an international event? Co-Buyer Automobile As a co-buyer on an automobile, can the other party take full possession? Both parties names are listed as the Purchaser's. Only one purchaser signed the retail order for the motor vehicle, and if so, how can one become a no co-buyer? Coffeescript existential operator sometimes checks against undefined, but not always During kill Bill, we learn that all the black mamba had to do to get Hanzo to build her a sword, was to mention Bill's name.  When black mamba meets Bill at the end, she tells him that all she did was mention his name. Bill responds with, "that'll do it!"  So what was it that Bill did to Hanzo to make him come out of retirement and make another weapon of death? Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this? It gets so horrible that I can not even switch to TTY1 to force a reboot. I have to hard reset, and I lose work.  Ideally, I would like to be able to use the chrome browser on Ubuntu without having to keep reminding myself to close tabs.   Are there any extensions for Chrome, or tools for Ubuntu that can help prevent me going past the point where Ubuntu eats up all the RAM and becomes incapacitated? How do I unit test code that includes a callout? Should I disconnect my MacBook Pro's power cord when the battery is fully charged? My friend told me that I need to disconnect the power cord when the battery is fully charged. Otherwise, I will shorten the life of the battery.  Other people say you should drain it once a month or point out that for long term storage, you should charge it to 50% and then periodically (3 to 6 months) bring it back to 50% and store it again.  I am going to use my laptop at home 90% of the time. So, I plan to have the power cord connected all the time.  I'd prefer to just plugging in my MacBook Pro and letting it be on charge long term and occasionally taking it away from the charger when I'm not at home or my desk.  Are these specific recommendations worth the inconvenience? How do I straighten UV maps? How to pretty print XML from Java? I have a Java String that contains XML, with no line feeds or indentations. I would like to turn it into a String with nicely formatted XML. How do I do this?  String unformattedXml = "&lt;tag&gt;&lt;nested&gt;hello&lt;/nested&gt;&lt;/tag&gt;"; String formattedXml = new [UnknownClass]().format(unformattedXml);   Note: My input is a String. My output is a String.   (Basic) mock result:    &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;root&gt;   &lt;tag&gt;     &lt;nested&gt;hello&lt;/nested&gt;   &lt;/tag&gt; &lt;/root&gt; I have the following diagram:    However, this looks a bit ugly, I would like a version that looks a little bit better. For example, size the last arrow such that the T_\phi is moved to the right.  This is the code which I am using to do this:  \begin{align*}   \xi \colon &amp;\lb \to \mathcal{L}(\hh)\\   &amp;\phi \mapsto T_\phi. \end{align*}   Where \lb and \hh just give the names for those spaces. Does anybody have a suggestion how I would improve the look of this function definition? TV show that starts with debris encompassing Earth What are the rules for China's visa-free transit programs? Assuming one wants to travel through China, what are the rules for visa-free access? To be more specific:   How does the 24-hour visa free transit work? How does the 72-hour version work? What does a person ineligible for either of these programs have to do to transit China? Do the programs apply to flights only or do they also work for transit on land? Would a visitor save much hassle by using visa free transit instead of just getting a visa?      NB: this is intended as a canonical question on transiting China SOQL query for Multiselect picklist How do I delete data for one game in the iPad Game Center? Query to list number of records in each table in a database Pass extra parameters to WebSQL callback function? Maximum likelihood when usual procedure doesn't work I am trying to get the maximum likelihood estimate for the parameter $p$. The distribution is the following:   $$ f(x\mid p) = \begin{cases} \frac{p}{x^2} &amp;\text{for} \ p\leq x &lt; \infty  \ \\ 0 &amp;\text{if not} \end{cases} $$  The sample has size $n$.  The problem is, when I try to estimate it by the procedure I know, I would have to estimate the likelihood function and obtain the derivative of the log-likelihood. We'd have:   $$ L(p; x) = \frac{p^n}{\prod_{i=1}^{n} x^2_i}$$  $$ \ln L(p;x) = n \ln(p) - \sum_{i=1}^{n} \ln(x_i^2) $$   For the derivative:  $$ l'(p;x) = \frac{n}{p} = 0$$   And I am stuck because it has no solution for $p$. How do I evaluate this?  Thanks!   EDIT:  So in this case I can use the indicator variable to write:   $$ L(p;x) = \frac{p^n}{\prod_{i=1}^{n}x_i^2} I_{(x_i \geq p)}$$   for $i = 1,2, \ldots n$ in the indicator variable. So the "closest" non-null value of $x \in X$ to $p$ is $min(X_1, \ldots X_n)$. Is that the point? Festival stores voicepack data in the following example directory structure:  /usr/share/festival/voices/&lt;language&gt;/&lt;voicepack name&gt;  What is the simplest one-liner (preferably using ls) to print out just the &lt;voicepack name&gt;'s, in all the potentially numerous &lt;language&gt; subdirectories?