另一个C ++模板问题,我不知道它来自哪里。我唯一的猜测是模板构造函数没有合成? (即使是合成这个术语来自我的ObjC背景,对C ++也不是很好)
我所能做的就是尽可能地简化代码,同时保持错误。现在,如果我删除State
构造函数,错误就会消失。但我需要一些构造函数来处理。
template<typename T>
class State {
public:
State();
};
#include "State.h"
template<typename T>
State<T>::State()
{}
#include "State.h"
class Match {
public:
State<Match> *currentState;
struct States {
static State<Match> Playing;
};
};
#include "Match.h"
State<Match> Match::States::Playing;
Undefined symbols for architecture x86_64:
"State<Match>::State()", referenced from:
___cxx_global_var_init in Match.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)