<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">tikitita</b> <<a href="mailto:guanxita@gmail.com">guanxita@gmail.com</a>><br>Date: 13-mar-2007 19:06<br>Subject: Errores de linkado de pila con templates
<br>To: <a href="mailto:cconclase@listas.conclase.net">cconclase@listas.conclase.net</a><br><br></span>Hola chicos me estoy haciendo una calculadora de notacion infija  en la que uso, una cola, una lista ordenada y una pila con templates. Al compilarlo todo no me da ningun error, pero al linkarlo me dan 12 errores de pila... tipo thiscall pila -> a las llamadas de las pilas... he probado a quitar los templates pero solo he conseguido que me den mas errores en el main. Os adjunto el codigo del cpp y del .h a ver si vosotros veis algo que yo no veo.
<br><br>**PILA.CPP**<br><br>#include "pila.h"<br><br><br><br><br><br>template<class t><br>pila<t>::pila(){<br>    cima=NULL;<br>}<br>/*template<class t><br>pila<t>::~pila(){<br>    struct nodolista *aux;
<br>    while (this->cima!=NULL){<br>        aux=this->cima;<br>        this->cima=this->cima->sig;<br>        delete aux;<br>    }<br>}*/<br>/*template<class t><br>pila<t>::pila(const pila<t> &p){
<br>    struct nodolista *aux;<br>    struct nodolista *aux2;<br>    aux=p.cima;<br>    while (aux!=NULL){<br>        aux2=new nodolista;<br>        aux2->inf=this->cima->inf;<br>        this->cima=aux2;<br>        aux=aux->sig;
<br>    }<br>}*/<br>template<class t><br>void pila<t>::insertar(t n){<br>    struct nodolista *nuevo=new nodolista;<br>    nuevo->inf=n;<br>    nuevo->sig=this->cima;<br>    this->cima=nuevo;<br>}
<br>
template<class t><br>void pila<t>::extraer(){<br>    struct nodolista *aux;<br>    aux=this->cima;<br>    if (aux!=NULL){<br>        this->cima=this->cima->sig;<br>        delete[]aux;<br>    }<br>

}<br>template<class t><br>    bool pila<t>::esvacia(){<br>        if(this->cima==NULL){<br>            return true;<br>        }else{<br>            return false;<br><br>        }<br>    }<br>template<class t>
<br>        int pila<t>::mostrar(){<br>            struct nodolista *aux;<br>            aux=this->cima;<br>            while(aux!=NULL){<br>                cout<<aux->inf<<endl;<br>                aux=aux->sig;
<br>            }<br>        }<br>template<class t><br>        pila<t> &pila<t>::operator =(const pila<t>&p){<br>            struct nodolista *aux;<br>            if (this->cima!=NULL){
<br>
                while(this->cima!=NULL){<br>                    aux=this->cima;<br>                    this->cima=this->cima->sig;<br>                    delete[]aux;<br>                }<br>            }<br>

        aux=p.cima;<br>        while (aux!=NULL){<br>            struct nodolista *nuevo=new nodolista;<br>            nuevo->inf=aux->inf;<br>            nuevo->sig=this->cima;<br>            this->cima=nuevo;
<br>            aux=aux->sig;<br>        }<br>        return *this;<br>        }<br>**************************************<br>**PILA.h**<br><br>#ifndef pila_H<br>#define pila_H<br>#include<cstdlib><br>#include <iostream>
<br>//#include <stdio><br><br>using namespace std;<br><br>template <class t><br>class pila {<br>private:<br>    struct nodolista{<br>    t inf;<br>        <br><br>    struct nodolista *sig;<br>    };<br>    nodolista* cima;
<br><br>public:<br>    pila();<br>    //pila(const pila &p);<br>    //~pila();<br>    void insertar(t n);<br>    void extraer();<br>    bool esvacia();<br>    int mostrar();<br>    pila& operator= (const pila &p);//para copiar una pila en medio del codigo//friend: no es parte de la clase pero puedo utilizar los atributos de ella
<br>};<br><br>#endif<br><br>****************************<br>Espero que me podais ayudar, muchas gracias.<br>