I simplify the problem. I wanna know why this can't compile:
Error message: undefined reference to 'Foo<int>::j'
a.h
#pragma once
template<typename T>  
class Foo{
    public:
        int bar(){
            return j;
        }
    private:
        static int j;
};
a.cpp
#include "a.h"
template<typename T>
int Foo<T>::j = 3;
main.cpp
#include "a.h"
#include <iostream>
using namespace std;
    int main() {
      Foo<int> f;
      cout << f.bar();
      return 0;
    }
 
    