I am using CMake (CLion) for a class project. I have tried the following solutions but they did not work: , , . I made a HeapSort class for a class project and I need to use it to sort a vector of strings (a dictionary). I create an instance of my HeapSort class in this dictionary as so: void Dictionary::heapSort() {     Heap&lt;std::string&gt; h;     stringDict = h.heapSort(stringDict); }  I keep getting an undefined reference to the constructor and the heapSort() function, where the class is defined as follows (heapSort() is similar): Heap.cpp #include &quot;Heap.h&quot; template &lt;typename T&gt; Heap&lt;T&gt;::Heap() {}  template &lt;typename T&gt; void Heap&lt;T&gt;::initializeMaxHeap(std::vector&lt;T&gt; v) {     heap = v;     heapSize = heap.size(); }  template &lt;typename T&gt; void Heap&lt;T&gt;::maxHeapify(int i) {     int l = left(i);     int r = right(i);     int large;     if (l &lt;= heapSize &amp;&amp; heap.at(l) &gt; heap.at(i))         large = l;     else         large = i;     if (r &lt;= heapSize &amp;&amp; heap.at(r) &gt; heap.at(i))         large = r;     if (large != i)     {         std::swap(heap.at(i), heap.at(large));         maxHeapify(large);     } }  template &lt;typename T&gt; void Heap&lt;T&gt;::buildMaxHeap() {     for (int i = std::floor(heap.size()/2); i &gt; 1; i++)         maxHeapify(i); }  template &lt;typename T&gt; std::vector&lt;T&gt; Heap&lt;T&gt;::heapSort(std::vector&lt;T&gt; v) {     initializeMaxHeap(v);     buildMaxHeap();     for (int i = heap.size(); i &gt; 2; i++)     {         std::swap(heap.at(1), heap.at(i));         heapSize--;         maxHeapify(1);     }     return heap; }  Heap.h #ifndef PROJ3_HEAP_H #define PROJ3_HEAP_H  #include &lt;cmath&gt; #include &lt;vector&gt;  #include &quot;Dictionary.h&quot;  template &lt;typename T&gt; class Heap { private:     std::vector&lt;T&gt; heap;     int heapSize;  public:     Heap();     int parent(int index) { return index/2; };     int left(int index) { return index * 2; };     int right(int index) { return index * 2 + 1; };     int getItem(int index) { return heap.at(index); };     void initializeMaxHeap(std::vector&lt;T&gt; v);     void maxHeapify(int i);     void buildMaxHeap();     std::vector&lt;T&gt; heapSort(std::vector&lt;T&gt; v);  };   #endif //PROJ3_HEAP_H  CMakeLists.txt cmake_minimum_required(VERSION 3.6) project(proj3)  set(CMAKE_CXX_STANDARD 11)  set(SOURCE_FILES main.cpp Dictionary.cpp Dictionary.h Grid.cpp Grid.h Heap.cpp Heap.h) add_executable(proj3 ${SOURCE_FILES})  Right now, I have all my files in one folder. What should I add to the CMakeLists.txt at this time? I have tried add_library/target_link_library (with different orders), adding include_directories, and I tried building each class in my directory separately the linking them to the main executable. Do I need to reorganize my directory as well? Edits: Added Heap.cpp &amp; Heap.h
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.)
Constructor not defined error in test code If a lens focuses all incoming light to a point, how do we get 2D images? How do lenses produce 2-dimensional images, if a lens bends all incoming rays of light to intersect at the focal point? Shouldn't this produce a single dot of light on a screen placed at the focal length?  This is basically the standard diagram that always shows up in textbooks:    I know this doesn't happen in real life--I used to use telescopes pretty frequently for work. The most in-focus image would be the one with the smallest diameters for the stars, which, of course, we think of point sources at infinity. But--the light from all stars (despite being at infinity) is not all focused at a single point. Instead, each star's light is focused at its own $(x,y)$ point on a 2D image.  I can't reconcile the theory as I understand it with any of my real-life experience with optics. What am I missing? We've had a number of instances over on Stack Overflow involving users who get to the reputation level where they can comment, then spam comments across the site. Due to the lack of community review around comments, these spammed comments can remain on the site for months before someone notices and flags one. Moderators then have to go and manually remove each of these comments. In the last few months, I've personally had to deal with two users who spammed their website across 200+ questions each.  This isn't just limited to people spamming comments with a URL in them. We've had a number of users spray the same nonsense comment or insult across tons of posts and have no one seem to notice for months.  What I'd like is some kind of system-generated notification when a user has posted a barrage of copied-and-pasted comments. This could possibly be triggered when a user has posted a set number of identical comments in a row (4 of them, maybe) or maybe even if they've posted the same comment multiple times. We receive similar system-generated flags when users post duplicate answers, edit many of their posts in a row, or delete many of their own posts at a time.  This system-generated flag should ignore comments generated by review (which have the same text in them). I'm thinking that it shouldn't ignore comments generated by custom off-topic reasons, because someone using the exact same close reason over and over again might be something we want to look into.  The flag itself won't do anything to a user, and would only appear to moderators. I imagine there will be a number of false positives, but it should be easy for us to check these and identify the well-intentioned stock comments from the problematic ones.   We currently have no means of detecting comment spam, so even if this didn't have a great hit rate it would still be beneficial on the balance. Running sample queries for this seems to indicate that it wouldn't have that much noise.  This would allow us to catch comment spam early, and prevent it from living on the site or developing into a more serious problem. Retaining all fishnet grid squares within boundary of polygon from another feature class? I have created a fishnet grid (3km x 3km) over a vector polygon.   I now want to clip the fishnet over the vector polygon retaining all grid squares within the boundary of the polygon.   Therefore I want all squares that would typically be clipped into partial squares to remain as whole squares.   Does anybody know how to do this? What does "in spades" mean? So, this sounds like a stupid question I know but in the bleachverse 'names' are very important and you can only unleash the power of your zanpakuto if you can call out its name. Therefore, if a shinigami is mute, will they ever be able to achieve shikai/bankai? If so then how? Only one case that I know of is for shinigamis who have already achieved bankai to be able to release their shikais without a command.  Answers based on LN are welcome, but if you are citing from a dubious source or a source whose canon status can be question, please specifically mention it. I am mostly interested in an answer based on a  canon source. Downloading all my questions with the answerer names I am writing several papers in which I use answers which I received in various StackExchange websites. Naturally I would like to acknowlege and thank the SE members that gave the useful answers. But there are many such answers, and each answer is relevant to a different paper.   So, I would like to download all the questions that I asked in the various SE websites, including the answerer names, to an Excel worksheet in which I can organize the questions by subject.  Is this possible? Where do the Python unit tests go? If you're writing a library, or an app, where do the unit test files go?    It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.    Is there a best practice here? What does the bracketed capital letter indicate in the revised version below? Is it essential, per the rules of proper punctuation, to do so? Are the ellipsis points (i.e., the spacing of the dots) spot on in that sentence to indicate the omission of one or more sentences?  Original quotation  "It need hardly be said that shortness is a merit in words. There are often reasons why shortness is not possible; much less often there are occasions when length, not shortness, is desirable. But it is a general truth that the short words are not only handier to use, but more possible in effect; extra syllables reduce, not increase, vigor."  Revised quotation  "It need hardly be said that shortness is a merit in words. . . . [S]hort words are not only handier to use, but more possible in effect; extra syllables reduce, not increase, vigor."  Thank you. How can animals in the wizarding world go close to extinction? Bootstrap CSS Active Navigation I am wondering what the difference between a definition and an axiom.  Isn't an axiom something what we define to be true?  For example, one of the axioms of Peano Arithmetic states that $\forall n:0\neq S(n)$, or in English, that zero isn't the successor of any natural number. Why can't we define 0 to be the natural number such that it isn't the successor of any natural number?  In general, why is an axiom not a definition?   Are there cases where we can formulate definitions as axioms or vice versa? polar decomposition of a square A when A is not full rank/invertible How to automatically hyphenate within \texttt? This question was phrased as a bug report for LaTeX and I thought it would be helpful to be presented here (including an answer).  The person had a lot of "common words" in typewriter font sprinkled around his text and he was surprised that this text would not automatically hyphenate and he had to manually insert \- to mark hypenation points. Stripped out bottom bracket The bottom bracket of my bike was completely stripped to the point that when you push the left side crank arm, the right crank moves and you can see the bottom bracket lock move out the frame. The bike shop tried putting Teflon tape but it's temporary. It's a 26' xc hard tail. For all I know both sides of the bottom bracket(square tapered) are stripped clean hence the Teflon tape put by the previous owner. Can I fix the problem by changing into a hallow tech cranks because it works like a thread less bb, or should I just buy a thread less square tapered bb? Any suggestion on what to do? How should I calculate $\lim_{n\rightarrow \infty} \frac{1^n+2^n+3^n+...+n^n}{n^n}$ How should I calculate the below limit  $$\lim_{n\rightarrow \infty} \frac{1^n+2^n+3^n+...+n^n}{n^n}$$ I have no idea where to start from. I am Haitian, and traveling with a Haitian passport. I have to go to London with a work permit (tier 2 visa) on the 29th of July but I have 2 hour transit in Dublin.  Do I need a transit visa? Can I get it at the airport?  I also have a valid US visa. Can there be an option to allocate rep from any site account for offering a bounty? I think it would be useful if we had an option when deciding to open a bounty on a question that we could choose to allocate rep from one site even though the bounty is being offered on another site.  For instance I would like to use my rep from SO for putting a bounty on a question that resides on SF. I don't have enough rep on SF to make it enticing. So when you click on "start a bounty" you get sliders for each site that you can pull your rep from, maybe make it where you need to burn up all your rep for the site that your asking the question on and then allocate more rep from other ones, if you have it.  thanks devinb for clearing up my question with your comments! " transfer rep INTO a bounty. But you can't transfer rep across accounts. So, the rep you'd 'lose' from SO would never actually go into your SF account, it would go straight onto a bounty on whatever question." – devinb Can I charge a computer through its USB port? Why is it that they decided to make String immutable in Java and .NET (and some other languages)? Why didn't they make it mutable?