好吧,标题说明了一切。链接时收到此消息(编译成功):
F:/Android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/
../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.ex
e: ./obj/local/armeabi/objs/hellondk/Player/Renderer.o: in function Renderer::On
SurfaceCreated():jni/Player/Renderer.cpp:63: error: undefined reference to 'void
GameObject::test<void>()'
游戏对象.h:
class GameObject
{
public:
...
template<typename T> T test();
}
游戏对象.cpp:
template<typename T> T GameObject::test()
{
}
Renderer.cpp(使用模板):
object = new GameObject();
...
object->test<void>(); // error here