0

So if I have class file in .h

class Test {
public:
    template<typename T>
    static void some_method(T t);
};

in .cpp

#include "Test.h"
#include <iostream>
template<typename T>
void Test::some_method(T t) {
    std::cout<<t;

}

And in main

#include "Test.h"
using namespace std;

int main() {
    Test::some_method(5);
}

Compiler writes to me undefined reference to void Test::some_method<int>(int), how can I fix that.

codeling
  • 10,672
  • 4
  • 37
  • 67
bruh
  • 1
  • 1

0 Answers0