コンパイラでこのエラーが表示されますが、その理由がわかりません。
`P3_A2.o: In function `allocateAlot(_sync*)':
/home/***/workspace_qnx/P3_A2/P3_A2.cpp:69: undefined reference to `int*
StaticMem::allocate<int>(int*)'`
ここにあるP3_A2.cpp
:
void allocateAlot(sem_t * sleepHere)
{
for (int i = 0; i < 10000; i++)
{
Int32 * t = StaticMem::allocate(t);
}
sem_wait(sleepHere);
}
ここにありStaticMem.h
ます:
クラス StaticMem
{
...
template <class T> static T * allocate(T * ptr);
}
ここにありStaticMem.cpp
ます:
template <class T>
T * StaticMem::allocate(T * ptr)
{
ptr = (T*) reserveContiguousMemory(sizeof(T));
return ptr;
}
誰かがこのエラーの原因を説明できますか?