I have a C++ classe in a .h file like this:  #ifndef __GLWidget_h__ #define __GLWidget_h__  class PivotShape {     // This is allowed     void do_something() { std::cout &lt;&lt; "Doing something\n"; }      // This is not allowed     void do_something_else(); }  // This is not allowed void PivotShape::do_something_else() {     std::cout &lt;&lt; "Doing something else\n"; }  #endif   If I add methods inside the class declaration everything seems fine. But if I add methods outside of the class declaration, I get errors like this:  /usr/share/qt4/bin/moc GLWidget.h &gt; GLWidget_moc.cpp /programs/gcc-4.6.3/installation/bin/g++ -W -Wall -g -c -I./ -I/usr/include/qt4 GLWidget_moc.cpp /programs/gcc-4.6.3/installation/bin/g++ main.o GLState.o GLWidget.o MainWindow_moc.o GLWidget_moc.o -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtOpenGL -lQtCore -lGLU -lGL -lm -ldl -o main GLWidget.o: In function `std::iterator_traits&lt;float const*&gt;::iterator_category std::__iterator_category&lt;float const*&gt;(float const* const&amp;)': /home/&lt;user&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/GLWidget.h:141: multiple definition of `PivotShape::do_someting_else()' main.o:/home/&lt;user&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/&lt;dir&gt;/GLWidget.h:141: first defined here   I think the duplication is being caused by this snippet in the Make file. I think the .h files are being converted to _moc.cpp files and this is allowing the multiple inclusions:  # Define linker LINKER        = /programs/gcc-4.6.3/installation/bin/g++  MOCSRCS       = $(QTHEADERS:.h=_moc.cpp)  # Define all object files to be the same as CPPSRCS but with all the .cpp # suffixes replaced with .o OBJ           = $(CPPSRCS:.cpp=.o) $(MOCSRCS:.cpp=.o)   Is this the problem? If so, how can I fix it? If not, what's going on?  I thought it was illegal in C++ to include class methods inside the body of the class declaration. If this is legal, then it seems like an easy way to solve the problem. Is this legal?  Edit:  I forgot to mention that I had already discovered that declaring the methods as inline works, but I was wondering how to avoid the duplication.
I have a c++ header file containing a class. I want to use this class in several projects, bu I don't want to create a separate library for it, so I'm putting both methods declarations and definitions in the header file:     // example.h #ifndef EXAMPLE_H_ #define EXAMPLE_H_ namespace test_ns{  class TestClass{ public:     void testMethod(); };  void TestClass::testMethod(){     // some code here... }  } // end namespace test_ns #endif   If inside the same project I include this header from more than one cpp file, I get an error saying "multiple definition of test_ns::TestClass::testMethod()", while if I put the method definition inside the class body this does not happen:  // example.h #ifndef EXAMPLE_H_ #define EXAMPLE_H_ namespace test_ns{  class TestClass{ public:     void testMethod(){         // some code here...     } };  } // end namespace test_ns #endif   Since the class is defined inside a namespace, shouldn't the two forms be equivalent? Why is the method considered to be defined twice in the first case?
Why PlotStyle->Dashed make everything dashed? Converting ArcGIS (*.mxd) file to QGIS (*.qgs) file? How to shrink Windows 7 boot partition with unmovable files How do I disable Dunst and go back to notify-osd? I installed i3, which recommends dunst, but I'm not using i3 at the moment, and the dunst notifications don't really fit with Unity. I'd rather not uninstall dunst totally, since I might want to start using it at some point in the future; is there a way to switch back to notify-osd without uninstalling dunst? Why does $1+2+3+\cdots = -\frac{1}{12}$? $\displaystyle\sum_{n=1}^\infty \frac{1}{n^s}$ only converges to $\zeta(s)$ if $\text{Re}(s) &gt; 1$.  Why should analytically continuing to $\zeta(-1)$ give the right answer? I have looked at other questions on this site (e.g. "why does space expansion affect matter") but can't find the answer I am looking for.  So here is my question: One often hears talk of space expanding when we talk about the speed of galaxies relative to ours. Why, if space is expanding, does matter not also expand? If a circle is drawn on balloon (2d plane), and the balloon expands, then the circle also expands. If matter is an object with 3 spatial dimensions, then when those 3 dimensions expand, so should the object.  If that was the case, we wouldn't see the universe as expanding at all, because we would be expanding (spatially) with it.  I have a few potential answers for this, which raise their own problems:   Fundamental particles are 'point sized' objects. They cannot expand because they do not have spatial dimension to begin with. The problem with this is that while the particles would not expand, the space between them would, leading to a point where the 3 non-gravity forces would no longer hold matter together due to distance Fundamental particles are curled up in additional dimensions a la string theory. These dimensions are not expanding. Same problems as 1, with the added problem of being a bit unsatisfying. The answer seems to be (from Marek in the previous question) that the gravitational force is so much weaker than the other forces that large (macro) objects move apart, but small (micro) objects stay together. However, this simple explanation seems to imply that expansion of space is a 'force' that can be overcome by a greater one. That doesn't sound right to me. I haven't been able to do this exercise:     Let $f: A \rightarrow B$ be any function. $f^{-1}(X)$ is the inverse   image of $X$. Demonstrate that if $f$ is surjective then $X = f(f^{-1}(X))$ where $X \subseteq B$.   Since $X \subseteq B$, all the elements in $X$ belong to the codomain of $f$.  Since $f$ is surjective, it means that all elements in the codomain $B$ have some preimage in $A$. Given that $X \subseteq B$, all elements in $X$ must also have a preimage in $A$.  Have $\triangle = f^{-1}(X)$, $\triangle$ is now a set containing the preimages of the elements in $X$. Because of this, $\triangle \subseteq A$.  If we evaluate $f(\triangle)$, we...... nope, I don't know what I'm doing now.    What do you think? I can not see how mathematically one can divide the numerator and denominator by theta. Can some one explain this in a different way. When you divide two fractions you multiply the first fraction by the reciprocal of the second. This is not the case here.     Divide numerator and denominator by $\theta$. ($\sin\theta$ also works.) $$\eqalign{\lim_{\theta\to0}\dfrac{\sin\theta}{8\theta+\tan\theta}&amp;= \lim_{\theta\to0}\dfrac{\dfrac{\sin\theta}\theta}{8+\dfrac{\sin\theta}\theta\cdot\dfrac1{\cos\theta}}\\&amp;=\dfrac{\lim\limits_{\theta\to0}\dfrac{\sin\theta}\theta}{8+\lim\limits_{\theta\to0}\dfrac{\sin\theta}\theta\lim\limits_{\theta\to0}\dfrac1{\cos\theta}}\\&amp;=\dfrac1{8+1\cdot1}\\&amp;=\dfrac19.}$$ Which shell interpreter runs a script with no shebang? Suppose the default shell for my account is zsh but I opened the terminal and fired up bash and executed a script named prac002.sh, which shell interpreter would be used to execute the script, zsh or bash? Consider the following example:  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % sudo cat /etc/passwd | grep papagolf [sudo] password for papagolf:  papagolf:x:1000:1001:Rex,,,:/home/papagolf:/usr/bin/zsh # papagolf's default shell is zsh  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % bash # I fired up bash. (See that '%' prompt in zsh changes to '$' prompt, indicating bash.)  papagolf@Sierra:~/My Files/My Programs/Learning/Shell$ ./prac002.sh  Enter username : Rex Rex # Which interpreter did it just use?   **EDIT : ** Here's the content of the script  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % cat ./prac002.sh  read -p "Enter username : " uname echo $uname booting windows 10 spends too long If $(X_n)$ is i.i.d. and $ \frac1n\sum\limits_{k=1}^{n} {X_k}\to Y$ almost surely then $X_1$ is integrable (converse of SLLN) Let $(\Omega,\mathcal F,P)$ be a finite measure space.  Let $X_n:\Omega \rightarrow \mathbb R$ be a sequence of iid r.v's  I need to prove that if:  $ n^{-1}\sum _{k=1}^{n} {X_k} $ converges almost surely to $Y$ then all $X_k$ have expectation.  If I understand correctly then $X_k$ has expectations means $X_k$ is in $\mathcal L^1(\Omega)$.  And I know that on finite measure space Converging in expectations is converging in $\mathcal L^1(\Omega)$ and it's stronger than almost sure convergence.  And I know that from linearity of expectation even if one of the sequence is not in $\mathcal L^1(\Omega)$ then $Y$ is not in $\mathcal L^1(\Omega)$.  How do I continue? I can't run this latex script Is there an easy method for installing binary builds of glibc? Time and time again I see questions such as these:       And these are the types of solutions we're typically pushing:        Is this really the best we can do? Aren't there binary builds of GLIBC that we can simply unzip into a directory such as /opt/myglibc, and set the $LD_LIBRARY_PATH or whatever and run whatever application we want, without issues?   An application, such as the newer builds of Chrome (28+) that appear to require GLIBC 2.14?  NOTE: This thread titled:  on tecmint.com is what ultimately got me thinking about this.  References Let $I = \{a +ib \in \Bbb Z[i] : a$ and $b$ are both multiple of $5\}$. Join CSV file to shapefile What kind of ring $R$ makes $\mathcal O(\mathrm{Proj}\,R[x_0,\cdots,x_n])=R$? How can I dynamically invoke a class method in PHP? The class method is not static. It appears that   call_user_func(...)   only works with static functions?  Thanks. Separability over intersection of intermediate fields Let $E\mathop{/}F$ be a finite-degree normal extension of fields. Let $K$ and $L$ be intermediate fields (that is, $F\subseteq K\subseteq E$ and $F\subseteq L\subseteq E$) such that $E$ is separable over both $K$ and $L$. Show that $E$ is separable over $K\cap L$.   So I was thinking that if $f=\min_{K\cap L}(\alpha)$. Then $\min_{K}(\alpha)$ divides $f$. But if $f$ has repeated roots then I don't see what goes wrong.   Thanks! How to use pagenumbering in the document? Since the Stack Exchange sites run on one clock, and a clock that is not common to most of us (such as those of us in the US), can we display a clock with the site time (UTC) displayed somewhere on every page, such as at the bottom with the other text?  That way we are more aware of when the days turn over, and ecetera...  close votes, delete votes, flags, and normal votes would also benefit from this as well (thanks @Grace Note!)...    What do you guys think? yea or nay? thoughts?