Foros del Web » Programación para mayores de 30 ;) » C/C++ »

No me compila undefined refrence to 'vtable'

Estas en el tema de No me compila undefined refrence to 'vtable' en el foro de C/C++ en Foros del Web. Hola miren ando haciendo un programa que maneje 1 clases y un main: Estado.h @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código C++: Ver original #ifndef ESTADO_H #define ESTADO_H using ...
  #1 (permalink)  
Antiguo 17/02/2013, 19:24
 
Fecha de Ingreso: febrero-2010
Mensajes: 31
Antigüedad: 14 años, 2 meses
Puntos: 0
No me compila undefined refrence to 'vtable'

Hola miren ando haciendo un programa que maneje 1 clases y un main:

Estado.h
Código C++:
Ver original
  1. #ifndef ESTADO_H
  2. #define ESTADO_H
  3. using namespace std;
  4. #include <string>
  5. class Estado
  6. {
  7.     private:
  8.         int ident;
  9.         bool estInit;
  10.     bool estEnd;
  11.    
  12.  
  13.     public:
  14.     Estado();
  15.         virtual ~Estado();
  16.         Estado(int ident,bool inits,bool ends);
  17.         void setIdent(int id);
  18.         void setInitS(bool inits);
  19.     void setEndS(bool ends);
  20.         int getIdent();
  21.     bool getInitS();
  22.     bool getEndS();
  23.        
  24.  
  25.  
  26. };
  27. #endif
Estado.c
Código C++:
Ver original
  1. #include "Estado.h"
  2.  
  3. Estado::Estado(int ident,bool inits,bool ends)
  4. {
  5.     this->ident=ident;
  6.     this->estInit=inits;
  7.     this->estEnd=ends;
  8. }
  9.  
  10.  
  11. void Estado::setIdent(int id){
  12.     ident=id;
  13. }
  14. void Estado::setInitS(bool inits){
  15.     estInit=inits;
  16. }
  17. void Estado::setEndS(bool ends){
  18.     estEnd=ends;
  19. }
  20. int Estado::getIdent(){
  21.     return ident;
  22. }
  23. bool Estado::getInitS(){
  24.     return estInit;
  25. }
  26. bool Estado::getEndS(){
  27.     return estEnd;
  28. }
El main.c
Código C++:
Ver original
  1. #include <iostream>
  2. #include <vector>
  3. #include"Trans.h"
  4. #include"Estado.h"
  5.  
  6. using namespace std;
  7.  
  8. int menu();
  9. void cargarAutomata(int numEstados,int numTrans);
  10. int main()
  11. {
  12.     int numEstados,numTrans,opc;
  13.     cout<<"\t\t**************************************\t\t"<<endl;
  14.     cout<<"\t\t*INGRESO DE PARAMAETROS PARA LA TABLA*\t\t"<<endl;
  15.     cout<<"\t\t**************************************\t\t"<<endl;
  16.     cout<<"Indica la cantidad de estados"<<endl;
  17.     cin>>numEstados;
  18.     cout<<"Indica la cantidad de transiciones"<<endl;
  19.     cin>>numTrans;
  20.    
  21.     cargarAutomata(numEstados,numTrans);
  22.     return 0;
  23. }
  24.  
  25.  
  26. void cargarAutomata(int numEstados,int numTrans){
  27.     vector<Estado>  states(numEstados,Estado());
  28.  
  29. }
Y por ultimo makefile
Código BASH:
Ver original
  1. CC=g++ -c
  2. LN=g++
  3.  
  4. Practica1:  Estado.o Trans.o
  5.     $(LN) Estado.o Trans.o -o Practica1
  6.  
  7. transicion.o: Trans.c
  8.     $(CC) Trans.c Trans.o
  9.  
  10. est.o: Estado.c
  11.     $(CC) Estado.c Estado.o

Me aparece lo siguiente
Código BASH:
Ver original
  1. g++ Estado.o Trans.o -o Practica1
  2. /usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
  3. (.text+0x18): undefined reference to `main'
  4. Estado.o: In function `Estado::Estado(int, bool, bool)':
  5. Estado.c:(.text+0x17): undefined reference to `vtable for Estado'
  6. Estado.o: In function `Estado::Estado(int, bool, bool)':
  7. Estado.c:(.text+0x51): undefined reference to `vtable for Estado'
  8. collect2: ld returned 1 exit status
  9. make: *** [Practica1] Error 1

Etiquetas: compila, int, programa, string, undefined
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:47.