저는 아래의 하나처럼 vC++에서 작동하는 C++ 클래스를 가지고 있지만, gcc 4.7에서는 더 이상 작동하지 않습니다. 그리고 나는 그것이 다시 작동하게하는 방법을 모른다.기본 클래스에서 메서드를 호출하는 방법 기본 클래스는 템플릿 매개 변수입니다.
test.h
template<typename a>
class test: public a
{
public:
void fun();
};
Test.cpp에
template<typename a>
void test<a>::fun()
{
template_class_method(); <-- this is a public method from template_class
}
template class test<template_class>;
template_class.h
class template_class {
public:
template_class();
virtual ~template_class();
void template_class_method();
};
template_class.cpp
#include "templateclass.h"
template_class::template_class() {
// TODO Auto-generated constructor stub
}
template_class::~template_class() {
// TODO Auto-generated destructor stub
}
void template_class::template_class_method() {
}
이 더 이상 작동하지 않는다는 것은 컴파일러 오류가 발생했음을 의미합니까? 그들에게 – Geoffroy
나쁜 말 보여줘. 오류 - 템플릿 매개 변수에 의존하는 'template_class_method'에 대한 인수가 없으므로 'template_class_method'의 선언을 사용할 수 있어야합니다 [-fpermissive]. –