I have written small program but getting undefined reference error. I'm not getting what I'm doing wrong  #include &lt;iostream&gt;  using namespace std; class A() { private:      static A *m_object;     A()     {         m_object = NULL;     }  public:      static A* getSingleton();      int returnVar()     {         return 45;     }  }; A* A::getSingleton() {     if(A::m_object == NULL)     {        A::m_object = new A();     }     return m_object; } int main() {     cout&lt;&lt;"Hello World";     A *a = A::getSingleton();     cout&lt;&lt;"Address of a"&lt;&lt;&amp;a&lt;&lt;endl;     cout&lt;&lt;"return a"&lt;&lt;a-&gt;returnVar()&lt;&lt;endl;     A *b = A::getSingleton();     cout&lt;&lt;"Address of a"&lt;&lt;&amp;b&lt;&lt;endl;     return 0; }   error  /home/main.o: In function `A::getSingleton()': main.cpp:(.text+0x3): undefined reference to `A::m_object' main.cpp:(.text+0x21): undefined reference to `A::m_object' /home/main.o: In function `main': main.cpp:(.text.startup+0x16): undefined reference to `A::m_object' main.cpp:(.text.startup+0x7e): undefined reference to `A::m_object' main.cpp:(.text.startup+0xcb): undefined reference to `A::m_object' /home/main..o:main.cpp:(.text.startup+0xde): more undefined references to `A::m_object' follow collect2: error: ld returned 1 exit status
Can anyone explain why following code won't compile? At least on g++ 4.2.4.  And more interesting, why it will compile when I cast MEMBER to int?  #include &lt;vector&gt;  class Foo {   public:       static const int MEMBER = 1;   };  int main(){       vector&lt;int&gt; v;       v.push_back( Foo::MEMBER );       // undefined reference to `Foo::MEMBER'     v.push_back( (int) Foo::MEMBER ); // OK       return 0; }
How did the AT-ATs get to the surface of Hoth? Can a satellite remain directly over a city? Is it possible to put an artificial satellite into an orbit in such a way that it will always remain direct over a city (I mean at any specific place)? Do you add Proficiency bonus AND the stat modifier to skill rolls? I know this basic knowledge, but I seemed to have missed this info in the player's manual.  Say someone makes an stealth check: do I add their Dexterity modifier and their proficiency bonus in Stealth to the roll? In other words, does the Dexterity modifier apply to all Dex-related skills, including ones with a proficiency? TikZ \foreach loop with macro-defined list I have a small problem with the TikZ \foreach loop whenever the list, over which we loop, is defined my a macro. The following code example will show my problem:  \documentclass{scrartcl} \usepackage[utf8]{inputenc} \usepackage{tikz}  \begin{document} Picture one:  \begin{tikzpicture} \foreach \x/\y in {1.0/2.0, 3.0/4.0} \node[draw] at (\x,\y) {\x--\y}; \end{tikzpicture}  Picture two:  \newcommand{\mymacro}{1.0/2.0, 3.0/4.0} \begin{tikzpicture} \foreach \x/\y in {\mymacro} \node[draw] at (\x,\y) {\x--\y}; \end{tikzpicture} \end{document}   The expected result is that both images should look the same. But in the second image, I only get one node - and both \x and \y are each time expanded to 1.0/2.0, 3.0/4.0. I hope someone can help. Can I travel to the UK unaccompanied on an accompanied child visa now that I am over 18? Last login: Mon Jun  7 22:43:40 on ttys000 samadams@Sams-MacBook-Pro-2 ~ % diskutil cs list No CoreStorage logical volume groups found samadams@Sams-MacBook-Pro-2 ~ % diskutil list /dev/disk0 (internal, physical):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *121.3 GB   disk0    1:                        EFI ⁨NO NAME⁩                 536.9 MB   disk0s1                     (free space)                         60.5 GB    -    2:                 Apple_APFS ⁨Container disk1⁩         60.1 GB    disk0s2  /dev/disk1 (synthesized):    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      APFS Container Scheme -                      +60.1 GB    disk1                                  Physical Store disk0s2    1:                APFS Volume ⁨MacOS Big Sur - Data⁩    30.0 GB    disk1s1    2:                APFS Volume ⁨Preboot⁩                 233.2 MB   disk1s2    3:                APFS Volume ⁨Recovery⁩                652.6 MB   disk1s3    4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4    5:                APFS Volume ⁨MacOS Big Sur⁩           24.4 GB    disk1s5    6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 24.4 GB    disk1s5s1    7:                APFS Volume ⁨Untitled⁩                860.2 KB   disk1s7 "A friend of my father" vs. "a friend of my father's" — which one is right? Why? I have seen them both in my reference book, which is written by a native speaker. I wonder why there are two different phrases to describe the same meaning and am looking forward to some reasonable details to explain why this is so. Why are there not generic phone OS installers? I am trying to solve an integral in $k$-space where I want to calculate the ratio of the average energy of an arbitrary electronic band ($E(k)=k^n)$ to the square of average group velocity of electrons($v_g   = k^{n-1})$ approximately in the form of this expression given by $$L=\frac{\frac{\sum_{\mathbf{k}}k^{n}}{\sum_{\mathbf{k}}1}}{\left(\frac{\sum_{\mathbf{k}}k^{n-1}}{\sum_{\mathbf{k}}1}\right)^2}\;.$$  Now, I want to do this for $d$-dimensions, so I convert this sum to integral.  $$L=\frac{\dfrac{\int_{0}^{k_f}k^{n} d^d k}{\int_{0}^{k_f}1d^d k}}{\left(\dfrac{\int_{0}^{k_f}k^{n-1}d^d k}{\int_{0}^{k_f}1d^d k}\right)^2}$$ where $d^dk  = \dfrac{d \pi^{d/2}}{\Gamma(\frac{d}{2}+1)}k^{d-1}dk$ is the volume element in $d$-dimensional space.  I want to get a simple expression for $L$ and how it depends with $k_f,n$ and $d$. any physical insight into this integral could also be helpful. How do I get a consistent byte representation of strings in C# without manually specifying an encoding? Ssh login hook? Do the search engines take the number of 404 errors returned by a site into account when calculating the site rank? For example I have 8,000 404 errors and I am thinking that that's affecting my SEO in a negative way.  However, I read  about 404 errors which suggests that they are not always a negative quality indicator.   So I am confused...are high numbers of 404 errors harmful to a site or not? Word that means "outdated name" Is there a word that means "outdated name"? For example:   Record, although very little music is on vinyl Film, although most movies are digital Horsepower, although no one uses horses as a metric anymore Phone, although it's mostly used to access the web   and so on. Can low-gravity planets sustain a breathable atmosphere? If astronauts could deliver a large quantity of breathable air to somewhere with lower gravity, such as Earth's moon, would the air form an atmosphere, or would it float away and disappear? Is there a minimum amount of gravity necessary to trap a breathable atmosphere on a planet? What is a proper way to clean a 35mm negative film stripe before scanning?   What chemicals can remove fingerprints, dust that does not come off by blowing, or strains of glue? What type of cloth does minimal damage when rubbing off dirt? Variance of product of dependent variables Tangent lines to ellipse from external point Accumulation Points for $S = \{(-1)^n + \frac1n \mid n \in \mathbb{N}\}$ I was recently asked to find the accumulation points of the set $$S = \{(-1)^n + \frac{1}{n} \mid n \in \mathbb{N}\}$$  I answered that the accumulation points are $\{-1,1\}$, because despite the fact that $\frac{1}{n}$ diverges, we can still use $\frac{1}{n}$ to find an element arbitrarily close to either $1$ or $-1$, i.e. to show that there is an element in an arbitrarily small neighborhood of $1$ or $-1$. (No proof was required for this question --- this is my intuition.)  Am I right at all? Cheap/free tool to view/convert Canon CR2 RAW format photo files on Windows? Which browsers are officially supported by Stack Exchange?  Also, what else is needed in order to use every feature of the site?