I have a code (C++) using templates and it works. I have the same code in another project and I get LINK2019 error. What I did: I deleted all other files and just kept a few test .h and .cpp files and opened a new project to avoid any interference with other files or code. I still get LINK2019 error! I have a similar example in another project which is working and I think I am missing something here. If I change the template to a function/method then I don't get LINK2019 in the simplified project.
I put the error message and the code below. Please let me know if you could see what I am missing:
Error: Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: void __thiscall TestUnit::Method(class TestIO)" (??$Method@VTestIO@@@TestUnit@@QAEXVTestIO@@@Z) referenced in function _main Test of Link Issue I:\Me\My C++\Sizing Modules\Process Equipment Sizing\Test of Link Issue\Test of Link Issue\Main.obj 1
Code: Main.cpp
       #include "TestIO.h"
       #include "TestUnit.h"
       #include <iostream>
       using namespace std;
       int  main()
       {
       TestUnit TU100;
       TestIO TestIO100;
       TU100.Method(TestIO100);
       //TU100.Method<TestIO>(TestIO100);
       //TU100.function();//This works!
       system("pause");
       return 1;
       }
////////////////////////////////////////////////
TestUnit.h
     class TestUnit
     {
          public:
      TestUnit();
      virtual ~TestUnit();
      template <class T>
      void Method(T IO);
      void function(void);
     };
////////////////////////////////////////////////////////// TestIO.h
          class TestIO
          {
                public:
            TestIO();
            virtual ~TestIO();
            double pressure = 1000;
          };
//////////////////////////////////////////// TestIO.h
     #include "TestIO.h"
     TestIO::TestIO() {}
     TestIO::~TestIO() {}
////////////////////////////////////////////////////////// TestUnit.cpp
       #include "TestUnit.h"
       #include <iostream>
       using namespace std;
       TestUnit::TestUnit() {}
       TestUnit::~TestUnit() {}
       template <class T>
       void TestUnit::Method(T IO)
       {
         cout << "In the template: Salute to C++!!!" << endl;
        //cout << "Here in TestUnit Pressure: " << IO.pressure << endl;
       }
       void TestUnit::function(void)
       {
        cout << "We love C++ !!!" <<  endl;
       }
 
    