Vector3D.h template(class Type) class cMVector3D { public: Type x; Type y; Type z; public: //-------------------------------- // @breif: Constructor //-------------------------------- cMVector3D(): x(0), y(0), z(0) {}; //-------------------------------- // @breif: Destructor //-------------------------------- ~cMVector3D() {}; }; main.mm --- if your program is objective c hybrid with c++, you need to rename your file ext. from *.m to *.mm. #import "MVector3D.h" int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; cMVector3D(float) testV; ~~~template success ...