This code does compile using the GNU gcc compiler while doesn't if using the Visual Studio 2008 one.
the error sas: "error C2143: syntax error: missing ';' before '*'
Arbol::Nodo* is a pointer to the class inside Arbol that works ok if compiling using codeblocks + gnu gcc compiler.
template <开发者_如何转开发class T>
Arbol<T>::Nodo<T>* Arbol<T>::Alta(Nodo<T>* &nodo,const T d) /////this line is highlited
{
return nodo;
}
It's weird, If I take out that code and compile again, it jumps three functions below it and throws the same error with this function
template<class T>
Arbol<T>::Nodo<T>* Arbol<T>::BuscarDevolver(const T t)
{
Nodo<T>* nodo = new Nodo<T>;
return nodo;
}
Add typename
:
template <class T>
typename Arbol<T>::Nodo<T>* Arbol<T>::Alta(Nodo<T>* &nodo,const T d) /////this line is highlited
{
return nodo;
}
You need to mark qualified names that are types explicitly within a template.
精彩评论