Linker error with C++ function template instantiation (member function of template-instantiated class) I have lots of existing C++ code with template classes that have implementations in the .cpp files. I want to add a template function to one such class. My problem is that I cannot make the compiler instantiate the function template.  I've created a stripped example demonstrating the problem. I want to add the member function convert(), with an own template parameter LenNew:  template &lt;typename Number, int Len&gt; class MyClass { public:     // the function I'm trying to add     template &lt;int LenNew&gt;     MyClass&lt;Number, LenNew&gt; convert();      // other methods I want to keep this way     void function(); // implemented in .cpp file  private:     Number n[Len]; };   In the existing setup, the .cpp file implements methods and instantiates the class template:  template &lt;typename Number, int Len&gt; void MyClass&lt;Number, Len&gt;::function() {     // implementation }  // instantiate template-class with specific template parameters template class MyClass&lt;double, 1&gt;;   So I added the implementation for my new member function, and tried to instantiate the template, which doesn't seem to work:  template &lt;typename Number, int Len&gt; template &lt;int LenNew&gt; MyClass&lt;Number, LenNew&gt; MyClass&lt;Number, Len&gt;::convert() {     // implement... }  // try instantiate template&lt;&gt; template&lt;&gt; MyClass&lt;double, 2&gt; MyClass&lt;double, 1&gt;::convert&lt;2&gt;();   It compiles fine, but I get an undefined reference when I try to use convert() from a different .cpp file:  main.cpp:(.text+0x1c): undefined reference to `MyClass&lt;double, 2&gt; MyClass&lt;double, 1&gt;::convert&lt;2&gt;()'   Here is a Gist with the demo program:   Sorry, there seem to be a lot of very similar questions, but I could still not grasp what is wrong.
Why can templates only be implemented in the header file? 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 am looking for an app that can monitor my C: (system) drive and find which program is creating a folder, with the rather generic name TEMP1\, on that drive.  I wouldn't mind if it could hook the creation of files too – as there a couple of files created as well (quite probably from another process). Google does not help me, as the names of those files are a bit generic too (not as TEMP1 though – dvmaccounts.ini and dvmexp.idx).   The problem is that every time I delete those, they are recreated on startup, so the utility I'm searching must start up on boot and also start fast. It should also be really clever, as my C: drive is huge. How do I set the default font size in Vim? Where does Drupal store its content? I have been currently learning Drupal while trying to duplicate a Drupal application into CakePHP.  I have been looking at the  database tables to know where data is being stored so I can safely migrate any data or study how it is working.  I have researched and have come across questions like:     So far, I have only seen the title in my Drupal (7) installation.  What I have seen in my node revisions table for a recipe content type, which includes fields like, field_ingredients, field_instructions, field_description, field_preptime, field_cookingtime, just the title of the recipe. This is a sample record on my node_revision table.  nid   |  vid  |  title         |  log   | timestamp  | status | comment | promote  | sticky ------------------------------------------------------------------------------------------- 1     |  1    |  Awesome Sauce |        | 1369998600 | 1      | 2       | 1        | 0   As you can see I can only see the title. Where are the other field contents? I have updated from Windows 7 Ultimate x64 to Windows 10 Pro x64 using Media Creation Tool.  After some weeks when I'm clicking on the start button nothing happens and the whole status bar becomes unresponsive. After trying to restart explorer.exe from Task Manager explorer.exe fails to initialize. It just shows the start button, Cortana and the search bar, TaskViewer (if that's how it is called) and the Action Centre button.  Any ideas?  I tried running:   sfc /scannow and no errors were found chkdsk /f and no errors were found   A full system restart seems to do the trick but after some time like a few hours it stops responding again.  My configuration:   CPU is Intel i5 4690K OC-d to 4.5Ghz GPU is AMD Radeon HD 7750 Saphire 1Gb GDDR5 Edition   EDIT: After some GOOGLE SEARCHING if i try to run from Task Manager C:\Windows i can actually open a window. The start bar isn't responding though and there are still no desktop icons or wallpaper. I want the entries in the TOC for the indices to align with the Chapter entries. I can do this with \addcontents. \printindex also puts an entry in the TOC but it is aligned with the section entries.   So I want to:    change how printindex makes its entry into the TOC or  to eliminate printindex entry.   MWE:  \documentclass{book} \usepackage{multind}        % create the indices \makeindex{names}            \makeindex{subject} \newcommand{\Ndx}[1] { \index{names}{#1} }     % define the type of entry \newcommand{\Sdx}[1] { \index{subject}{#1} }   % to the indices \usepackage[headings]{fullpage}         % 8-1/2, 11 page with 1" margins \usepackage{fancyhdr} \pagestyle{fancy} \begin{document} \fancyhead{} \fancyfoot{} \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} \fancyhead[LE,RO]{\rightmark} \fancyhead[RE,LO]{\thepage} \tableofcontents        % put table of contents here  \chapter{\bf Logic, Plausibility, and Probability} \label{Ch:Logic} \section{Logical Arguments and Reasoning } It is obvious that logical arguments are essential to the judicial system. The logic must be able to treat syllogisms\Sdx{syllogism} that range from deductive\Sdx{syllogism!deductive} to abductive\Sdx{syllogism!abductive}, that is from strong to weak syllogisms \Sdx{syllogism!weak}\Sdx{syllogism!strong} as illustrated in the table taken from Author \Ndx{Author} \Ndx{Cohen} \Sdx{Cohen on probability} \clearpage \addcontentsline{toc}{chapter}{Subject Index} \printindex{subject}{Subject Index} \addcontentsline{toc}{chapter}{Name Index} \printindex{names}{Name Index} \end{document} How to find the joint PDF? If you draw two cards, what is the probability that the second card is a queen? We had this question arise in class today and I still don't understand the answer given. We were to assume that drawing cards are independent events. We were asked what the probability that the second card drawn is a queen if we take two from the deck. The answer given was 4/52, which seems counter-intuitive to me. How is the probability still 4/52 if there was a card drawn before it? What if the first card drawn was a queen? Fast way of copying IMAP to IMAP on CentOS I'm trying to copy of IMAP emails from one server to my new server but after Googling for hours and trying several tools, nothing is working. Is there a tool that actually works?  I am copying hundreds of thousands of emails so using a email client is out of the question, I tried it, and at the rate of a email per 2 seconds, it would take a few weeks or months!  www.linux-france.org/prj/imapsync/ is commonly mentioned, however, the tool is no longer available.  I tried www.athensfbc.com/imap_tools/ which just hangs and does nothing.  Any migration tools that work? Bluetooth indicator disappears on turning off bluetooth Everytime I turn off my bluetooth, the indicator icon in the system tray disappears, as opposed to just greying out as expected. Next time I need to go to the settings select bluetooth to turn it on, which makes the indicator to reappear.  Is there anyway I can make the indicator icon not disappear but stay greyed out when not in use? Prime ideal and nilpotent elements Graph nodes coordinates evaluation New SSD problem I've just installed a new SSD replacing an HDD in my old (late 2008) iMac. When I switched it on all I got on screen was a question mark.   On the advice of my son I tried cmdR during switch on with no result.   I then tried alt which at least got me a cursor on the screen, but nothing else. Any suggestions? I've got everything backed up on an external Hard Drive, by the way. Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something)  static String intToString(int num, int digits) {     StringBuffer s = new StringBuffer(digits);     int zeroes = digits - (int) (Math.log(num) / Math.log(10)) - 1;      for (int i = 0; i &lt; zeroes; i++) {         s.append(0);     }     return s.append(num).toString(); } How to wait in bash for several subprocesses to finish and return exit code !=0 when any subprocess ends with code !=0? How do I disable updating a form in Windows Forms? During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it? Can someone identify this book, where children are bred for specific jobs? Things I remember about this book:   Every child was selected for a certain job/career; If twins were born, one was always killed; Seeing colors for the first time (describing the color of an apple); Seeing war and death and poverty.   Does anyone have any idea what this book might be? Why are there no Pokémon near me? What documentation is needed for a tourist to drive a US citizen's car? The  currently says  In the context of Stack Exchange sites, any copying and pasting of any amount of text or code that wasn't written by you is plagiarism if you try, explicitly or implicitly, to pass it off as your own work. (italics mine)  There is also a concept of . Should this also be addressed in the FAQs? In other words, is it OK to copy (large parts of) your own answer  without proper attribution? accounting for LED resistance