I know there have already been topics on this matter but I unfortunately cannot solve my problem due to my beginner level in C++ programming.  I am on OS X Maverick  on this topic:   it is mentioned that the issue of getting the 'Undefined symbols for architecture x86_64' compiling error was often solved by using the option -stdlib=libstdc++ My question is very simple: how do you use this option on Xcode? I am pretty sure it is in Build settings->Apple LLVM 5.1 - Language - C++ -> C++ Standard Library where I can choose libstdc++ instead of libc++ but I am still getting the compiling error when setting this to libstdc++.  The code I'm trying to compile is some template instantiation:  HEADER FILE (range.h) #ifndef Proj_range_h #define Proj_range_h  template &lt;class Type&gt; class Range { private:     Type lo;     Type hi;  public:     //Constructors     Range(); //Default constructor     Range(const Type&amp; low, const Type&amp; high); //low and high value     Range(const Range&lt;Type&gt;&amp; ran2); //copy constructor      //Destructor     virtual ~Range();      //Modifier functions     void low(const Type&amp; t1); //to set the low value     void high(const Type&amp; t1); //to set the high value      //Accessing functions     Type low() const; //lowest value in range     Type high() const; //highest value in range      Type spread() const; //high - low value  };   #endif    CLASS MEMBER FUNCTIONS CODING (range.cpp) #include "range.h" template &lt;class Type&gt; Range&lt;Type&gt;::Range(const Range&lt;Type&gt;&amp; r2) {     //Copy constructor     lo=r2.lo;     hi=r2.hi; }  template &lt;class Type&gt; Range&lt;Type&gt;::Range(const Type&amp; low, const Type&amp; high) {     lo=*low;     hi=*high; }   template &lt;class Type&gt; Type Range&lt;Type&gt;::spread() const {     return hi-lo; }  template &lt;class Type&gt; Range&lt;Type&gt;::~Range&lt;Type&gt;() {     //Destructor }   MAIN FILE (main.cpp) #include "range.h" #include &lt;iostream&gt;  int main() {     double closingPrice=40;      double openingPrice=60;      Range&lt;double&gt; bearish(closingPrice,openingPrice);      return 0; }   I hope my question is clear enough.  Thanks
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.)
EM with Binomial How exactly does Knuth's Up-Arrow notation work? Trying to locate a file, how can I search the entire hard drive for a file? A smooth vector field on $S^2$ vanishing at a single point Search in favorited questions? I wonder if it is possible to search in just my favorited questions?  If not, can it be considered as a feature request? Prove the map has a fixed point Distribution of a ratio of uniforms: What is wrong? Suppose that  $X$ and $Y$ are two i.i.d. uniform random variables on the interval $[0,1]$  Let $Z=X/Y$, I am finding the cdf of $Z$, i.e. $ \Pr(Z\leq z) $.  Now, I came up with two ways of doing this. One produces a correct answer consistent with the pdf here: , the other does not. Why is the second method wrong?  First Method  $\newcommand{\rd}{\mathrm{d}} \Pr(Z\leq z) = \Pr(X/Y\leq z) = \Pr(X\leq zY) = \int^{1}_{0}\int^{\min(1,zy)}_{0} \rd x \rd y = \int^{1}_{0}\min(1,zy)\ \rd y$ $  = \left\{      \begin{array}{lr}        \int^{1/z}_{0}zy\ \rd y + \int^{1}_{1/z} \rd y&amp; : z &gt; 1\\        \int^{1}_{0}zy\ \rd y &amp; : z \leq 1      \end{array}    \right. $ $  = \left\{      \begin{array}{lr}        1 - \frac{1}{2z} &amp; : z &gt; 1\\        \frac{z}{2} &amp; : z \leq 1      \end{array}    \right. $  This appears correct.  Second Method  $\Pr(X/Y\leq z) = \Pr(X \leq zY\ |\ zY \geq 1)\Pr(zY \geq 1) + \Pr(X \leq zY\ |\ zY &lt; 1)\Pr(zY &lt; 1) $ by total probability  $ = \Pr(X \leq zY\ |\ zY \geq 1)\Pr(Y \geq 1/z) + \Pr(X \leq zY\ |\ zY &lt; 1)\Pr(Y &lt; 1/z)$  Taking $z&gt;1$ yields $ (1)(1-\frac{1}{z}) + (\int^{1/z}_{0}\int^{zy}_{0} \rd x \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + (\int^{1/z}_{0}zy\ \rd y)(\frac{1}{z}) = 1-\frac{1}{z} + \frac{1}{2z^{2}}$  This is already different. Why is this wrong?  Thanks! Can I use HMAC-SHA1 in counter mode to make a stream cipher? Say I have an embedded device which is only capable of doing HMAC-SHA1 transformations (that device is, in fact, a YubiKey).  Would it be secure to feed it like a block cipher in counter mode to get a random pad suitable as an stream cipher?  Of course, I'm talking about not repeating the counter value ever to encrypt data (so this construction would also need some random IV or treating the counter value as a nonce forever). How to create a local APT repository? I would like to build my own local repository on my LAN, so that machines on the LAN can update and upgrade from it. I want to download the packages and store them on my local server so that I can update, upgrade, install, etc, from it without using the internet. Parse JSON in JavaScript? Troubleshoot High CPU usage by the "System" process Can NDSolve handle discontinuous data? Proving the countability of algebraic numbers I am trying to prove that algebraic numbers are countably infinite, and I have a hint to use: after fixing the degree of the polynomial, consider summing the absolute values of its integer coefficients, and setting the sum less than or equal to $m$, for each $m \in \mathbb{N}$. I am also allowed to use the fact that every polynomial has a finite number of roots. I am not sure where to begin... Perhaps after fixing the degree of the polynomials, I could try enumerating them, and after proving countability of the set that contains the roots of all polynomials of a certain degree, I could state that the union of infinitely many ($\bigcup_{n=1}^{\infty}$, $n \in \mathbb{N}$) countably infinite sets is countable, and thus the algebraic numbers are countably infinite, too, but I am not sure if this is a good approach/how to enumerate the polynomials. Thanks! I'm building an object detector using HOG features and linear SVM. Some of the regions of the object are more "distinctive" so I would like to give more weight to the features extracted from those regions. (e.g. imagine we want to detect between mugs and glasses, then the most "distinctive" part is the mug's handle)  How could I do this? For sure there should be a more intelligent way than just replicating the features of those "distinctive" regions. Add a downvote option in the VLQ review There are many answers that are well-formed and well-formatted but are simply plain wrong or misleading. When reviewing, I often have a hard time deciding which action to take, as:   Looks Good: is OK per se but I would never say "good" (would work if the wording was changed slightly), Edit: The question is formatted well and editing it to be right would go against the intent of the author, Recommend deletion: this looks like the most reasonable choice, but I wouldn't flag it if I were browsing the site in normal mode, Not sure: I am quite sure what is wrong but I end up clicking this because the other three options do not seem fitting.   My proposal is to add a fifth option - Downvote that would make it easier to choose in case of such answers. jQuery: live() vs delegate() Canonical has recently announced , which is Ubuntu with a specific interface for mobile devices.  Where can I get phones with this version of Ubuntu pre-installed? If no devices are available yet, where can I pre-order one? What are the limits on how I can cast, change, and retract votes? Wacom Graphics Tablet CTH-480 / CTL-480 Not Detected In Ubuntu 13.10 My Wacom tablet (CTH-480) is not detected by the Wacom Tablet option under settings. The Tablet shows up when I run lsusb but does not show up under settings. Again Thanks. Other word for person who does something to others but does'nt like it done to them This is a duplicate question but has still not been answered for me. I'm so close to the exact word - I know there is one out there - but the closest word I can find is a hypocrite --     a person who claims to have certain moral principles or beliefs but behaves in a way that shows they are not sincere.    The word I'm looking for is a person who does not claim things, but does thing to another and they consider it wrong or immoral to have done to them.