title: c++ template variadic function undefined reference
body: <p>TestTempB.h</p>
  
  <pre><code>#ifndef TESTTEMPB_H_
  #define TESTTEMPB_H_
  #include &lt;string&gt;
  using namespace std;
  namespace ddl_lib {
  
  class TestTempB {
  public:
      TestTempB();
      virtual ~TestTempB();
      template&lt;class ... Args&gt;
      void callCommandB(const string&amp;, const uint32_t*, Args ...);
      template&lt;class ... Args&gt;
      void callCommandA(const string&amp;, Args ...);
  };
  
  } /* namespace ddl_lib */
  
  #endif /* TESTTEMPB_H_ */
  </code></pre>
  
  <p>TestTempB.cpp</p>
  
  <pre><code>#include "TestTempB.h"
  #include "TestTempA.h"
  #include "stdint.h"
  #include &lt;iostream&gt;
  namespace ddl_lib {
  
  TestTempB::TestTempB() {
      // TODO Auto-generated constructor stub
  
  }
  
  TestTempB::~TestTempB() {
      // TODO Auto-generated destructor stub
  }
  
  template&lt;class ... Args&gt;
  void TestTempB::callCommandB(const string&amp; cmdName, const uint32_t* cmdSn, Args ... params) {
      cout &lt;&lt; cmdName &lt;&lt; endl;
  }
  template&lt;class ... Args&gt;
  void TestTempB::callCommandA(const string&amp; cmdName, Args ... params) {
      callCommandB(cmdName, NULL, params...);
  }
  } /* namespace ddl_lib */
  </code></pre>
  
  <p>main</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "TestTempB.h"
  using namespace std;
  using namespace ddl_lib;
  
  int main() {
      string aa="15615";
      bool ccc=false;
      TestTempB b;
      b.callCommandA("name", &amp;aa, &amp;ccc);//undefined reference to `void ddl_lib::TestTempB::callCommandA&lt;std::string*, bool*&gt;(std::string const&amp;, std::string*, bool*)'
  }
  </code></pre>
  
  <p>I'm using the  variadic-template.
  Why the gcc can't deduced the real func?
  When the callCommandA and callCommandB in the main file,it works just fine.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "TestTempB.h"
  using namespace std;
  using namespace ddl_lib;
  template&lt;class ... Args&gt;
  void callCommandB(const string&amp; cmdName, const uint32_t* cmdSn, Args ... params) {
      cout &lt;&lt; cmdName &lt;&lt; endl;
  }
  template&lt;class ... Args&gt;
  void callCommandA(const string&amp; cmdName, Args ... params) {
      callCommandB(cmdName, NULL, params...);
  }
  int main() {
      string aa = "15615";
      bool ccc = false;
      callCommandA("name", &amp;aa, &amp;ccc); //no erro
  }
  </code></pre>
  
  <p>Why and how could I fix it?
  Thanks!!!</p>